In [49]:
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
sorted(plt.style.available)
Out[49]:
In [50]:
def make_title(s):
return s.replace('-', ' ').replace('_', ' ').title()
def make_plots(style_str=None):
fig, axes_array = plt.subplots(2, 2)
((ax1, ax2), (ax3, ax4)) = axes_array
# sine and cosine line plots
x = np.arange(10)
y_sin = np.sin(x)
y_cos = np.cos(x)
ax1.plot(x, y_sin)
ax1.plot(x, y_cos)
ax1.set_title('sine and cosine line plots')
# a random scatter plot
points1 = np.random.rand(20,2)
points2 = np.random.rand(20,2)
ax2.scatter(points1[:, 0], points1[:, 1])
ax2.scatter(points2[:, 0], points1[:, 1])
ax2.set_title('a random scatter plot')
# a random bar graph
width = 0.4
middles = np.arange(1, 6)
heights1 = np.random.rand(5)
heights2 = np.random.rand(5)
ax3.bar(middles - width, heights1, width)
ax3.bar(middles, heights2, width)
ax3.set_title('a random bar graph')
# a random pie chart
values = np.random.rand(5)
frac_values = values/values.sum()
labels = ['A', 'B', 'C', 'D', 'E']
ax4.pie(frac_values, labels=labels)
ax4.set_title('a random pie chart')
# draw them!
fig.suptitle('{} ({})'.format(make_title(style_str), style_str) if style_str else 'Default Settings', fontsize=20)
fig.subplots_adjust(hspace=0.3)
fig.set_size_inches(10, 10)
plt.show()
import seaborn
!)
In [51]:
make_plots()
In [52]:
with plt.style.context(('seaborn-darkgrid')):
make_plots('seaborn-darkgrid')
In [53]:
with plt.style.context(('seaborn-whitegrid')):
make_plots('seaborn-whitegrid')
In [54]:
with plt.style.context(('seaborn-dark-palette')):
make_plots('seaborn-dark-palette')
In [55]:
with plt.style.context(('seaborn-paper')):
make_plots('seaborn-paper')
In [56]:
with plt.style.context(('seaborn-talk')):
make_plots('seaborn-talk')
In [57]:
with plt.style.context(('seaborn-dark')):
make_plots('seaborn-dark')
In [58]:
with plt.style.context(('seaborn-bright')):
make_plots('seaborn-bright')
In [59]:
with plt.style.context(('ggplot')):
make_plots('ggplot')
In [60]:
with plt.style.context(('grayscale')):
make_plots('grayscale')
In [61]:
with plt.style.context(('seaborn-pastel')):
make_plots('seaborn-pastel')
In [62]:
with plt.style.context(('bmh')):
make_plots('bmh')
In [63]:
with plt.style.context(('seaborn-colorblind')):
make_plots('seaborn-colorblind')
In [64]:
with plt.style.context(('seaborn-ticks')):
make_plots('seaborn-ticks')
In [65]:
with plt.style.context(('fivethirtyeight')):
make_plots('fivethirtyeight')
In [66]:
with plt.style.context(('dark_background')):
make_plots('dark_background')
In [67]:
with plt.style.context(('seaborn-white')):
make_plots('seaborn-white')
In [68]:
with plt.style.context(('classic')):
make_plots('classic')
In [69]:
with plt.style.context(('seaborn-notebook')):
make_plots('seaborn-notebook')
In [70]:
with plt.style.context(('seaborn-muted')):
make_plots('seaborn-muted')
In [71]:
with plt.style.context(('seaborn-deep')):
make_plots('seaborn-deep')
In [72]:
with plt.style.context(('seaborn-poster')):
make_plots('seaborn-poster')