skip to navigation
skip to content

Not Logged In

MatPlotTheme 0.1.2

MatPlotTheme is a theming library for MatPlotLib.

MatPlotTheme is a theming library for MatPlotLib. Greatly inspired by prettyplotlib, MatPlotTheme aims to provide easy-to-use APIs for creating proper and attractive data visualizations.

In MatPlotTheme, theming MatPlotLib figures is controlled by style and palette, which defines how elements are customized and which colors are used, respectively. As MatPlotTheme provides multiple styles/palettes (at least that is what I am working on), using the library is as simple as picking a style-palette combination and plot. What’s more, MatPlotTheme inherits MatPlotLib’s API configuration, which means existing code can be migrated with minimal effort.

Examples

Documentation

Read documentation.

Usage

MatPlotTheme provides a default Style and a default Palette. Each of them are python classes and all other styles/palettes are derived classes of them. matplottheme provides interfaces to all plotting methods in Style, which enable library usage like matplottheme.plot(ax, x, y).

# Use API provided by matplottheme module
import matplottheme as mpt
import matplotlib.pylab as plt
import numpy as np

x = np.arange(1000)
y = np.random.normal(size=1000).cumsum()

fig = plt.figure()
ax = fig.add_subplot(111)
# MatPlotTheme plots a line using ggplot2 style/palette
mpt.set_theme('ggplot2', 'ggplot2')
mpt.plot(ax, x, y)

This code block can also generate the same plot as the first one.

# Use style/palette objects
from matplottheme.style.ggplot2 import ggplot2Style
from matplottheme.palette.ggplot2 import ggplot2Palette
import matplotlib.pylab as plt
import numpy as np

x = np.arange(1000)
y = np.random.normal(size=1000).cumsum()

fig = plt.figure()
ax = fig.add_subplot(111)
# Manually using ggplot2 style/palette
ggplot2Style(ggplot2Palette()).plot(ax, x, y)

Dependency

  • MatPlotLib. pip install matplotlib is the most simple installation method.

License

The MIT License (MIT)

Copyright (c) 2014 James Yu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 
File Type Py Version Uploaded on Size
MatPlotTheme-0.1.2.zip (md5) Source 2014-07-31 1MB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 60 downloads in the last week
  • 262 downloads in the last month