prettyplotlib.plot
ExampleThe default matplotlib color cycle is not pretty to look at ... It was taken from MATLAB's color cycle. Need to do this example first because prettyplotlib
changes the default color cycle to a nicer one, from ColorBrewer's Set2.
In [2]:
import matplotlib.pyplot as mpl_plt
# Set the random seed for consistency
np.random.seed(12)
fig, ax = mpl_plt.subplots(1)
# Show the whole color range
for i in range(8):
y = np.random.normal(size=1000).cumsum()
ax.plot(y)
fig.savefig('plot_matplotlib_default.png')
Yeah.. not nice
In [1]:
import prettyplotlib as ppl
# prettyplotlib imports
from prettyplotlib import plt
from prettyplotlib import mpl
from prettyplotlib import brewer2mpl
# Set the random seed for consistency
np.random.seed(12)
fig, ax = plt.subplots(1)
# Show the whole color range
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)
fig.savefig('plot_prettyplotlib_default.png')
In [ ]: