In [1]:
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = plt.subplots(1)
ax.hist(np.random.randn(1000))
fig.savefig('hist_matplotlib_default.png')
And if you add a grid, it looks pretty gross.
In [2]:
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = plt.subplots(1)
ax.hist(np.random.randn(1000))
ax.grid(True)
fig.savefig('hist_matplotlib_grid.png')
With prettyplotlib.hist
, we make the outlines of the rectangles white, remove the top and right axis lines, thin out the remaining axis lines, and change the blacks from regular black to a light grey (#262626)
In [1]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = plt.subplots(1)
ppl.hist(np.random.randn(1000))
fig.savefig('hist_prettyplotlib_default.png')
And you can add a grid over the $y$-axis if you like. It's "erasing" some of the figure, but it's actually adding information, since it shows the tick lines!
In [ ]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = plt.subplots(1)
# 'y' for the 'y' axis. Could also add a grid over the 'x' axis.
ppl.hist(ax, np.random.randn(1000), grid='y')
fig.savefig('hist_prettyplotlib_grid.png')
In [2]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = plt.subplots(1)
# 'y' for the 'y' axis. Could also add a grid over the 'x' axis.
ppl.hist(ax, np.random.randn(1000), grid='y')
fig.savefig('hist_prettyplotlib_grid.png')
In [1]:
%load_ext autoreload
%autoreload 2
In [3]:
%pdb
In [2]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(12)
fig, ax = ppl.subplots()
# 'y' for the 'y' axis. Could also add a grid over the 'x' axis.
for i in range(2):
ppl.hist(np.random.randn(1000), grid='y')
fig.savefig('hist_prettyplotlib_two_datasets.png')
In [9]:
ax._get_lines.color_cycle
Out[9]:
In [6]:
print [(k,v) for k,v in ax.__dict__.iteritems() if 'cycle' in k]