matploblib style Demo

matploblib added a style package in 1.4.2. Here's a quick view of how these styles look.


In [1]:
%matplotlib inline
from matplotlib import style
import matplotlib.pyplot as plt
import numpy as np

In [2]:
xs = np.linspace(-5, 5, 1000)
ys = np.cos(xs)
print(style.available)


[u'dark_background', u'bmh', u'grayscale', u'ggplot', u'fivethirtyeight']

Default


In [3]:
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()


dark_background


In [4]:
style.use('dark_background')
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()


bmh


In [5]:
style.use('bmh')
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()


grayscale


In [6]:
style.use('grayscale')
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()


ggplot


In [7]:
style.use('ggplot')
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()



In [8]:
## fivethiryeight

In [9]:
style.use('fivethirtyeight')
plt.plot(xs, ys, label='$sin(x)$')
plt.legend()
plt.grid()