http://olgabot.github.io/prettyplotlib/
%run talktools
%matplotlib inline
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import prettyplotlib as ppl
from prettyplotlib import brewer2mpl
fig, ax = plt.subplots(figsize=(8, 6))
for i in range(8):
x = np.random.normal(loc=i, size=1000)
y = np.random.normal(loc=i, size=1000)
ppl.scatter(ax, x, y, label=str(i))
ppl.legend(ax);
And here's matplotlib for comparison
# Show the whole color range
fig, ax = plt.subplots(figsize=(8, 6))
for i in range(8):
x = np.random.normal(loc=i, size=1000)
y = np.random.normal(loc=i, size=1000)
plt.scatter(x, y, label=str(i))
plt.legend();
Other plot types are available as well:
fig, ax = plt.subplots(figsize=(8, 6))
for i in range(8):
y = np.random.normal(size=1000).cumsum()
x = np.arange(1000)
# For now, you need to specify both x and y :(
# Still figuring out how to specify just one
ppl.plot(ax, x, y, label=str(i), linewidth=0.75)
ppl.legend(ax);
Also some nice plot annotations with nice color selections:
import string
fig, ax = plt.subplots(figsize=(8, 6))
np.random.seed(14)
n = 10
ppl.bar(ax, np.arange(n), np.abs(np.random.randn(n)),
annotate=range(n,2*n), grid='y', xticklabels=string.uppercase[:n])
<Container object of 10 artists>
See more examples at http://olgabot.github.io/prettyplotlib/