In [1]:
import matplotlib.pyplot as plt
import numpy as np
import string
fig, ax = plt.subplots(1)
np.random.seed(14)
ax.bar(np.arange(10), np.abs(np.random.randn(10)))
fig.savefig('bar_matplotlib_default.png')
In [6]:
%load_ext autoreload
%autoreload 2
In [11]:
import prettyplotlib
In [1]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
from pandas.util.testing import rands
fig, ax = plt.subplots(1)
np.random.seed(14)
ppl.bar(ax, np.arange(10), np.abs(np.random.randn(10)))
fig.savefig('bar_prettyplotlib_default.png')
And as with prettyplotlib.hist
, you can also add a grid:
In [2]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1)
np.random.seed(14)
# 'y' for make a grid based on where the major ticks are on the y-axis
ppl.bar(ax, np.arange(10), np.abs(np.random.randn(10)), grid='y')
fig.savefig('bar_prettyplotlib_grid.png')
In [3]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
import string
fig, ax = plt.subplots(1)
np.random.seed(14)
n = 10
ppl.bar(ax, np.arange(n), np.abs(np.random.randn(n)), annotate=True, grid='y')
fig.savefig('bar_prettyplotlib_grid_annotated.png')
In [4]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
import string
fig, ax = plt.subplots(1)
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')
fig.savefig('bar_prettyplotlib_grid_annotated_user.png')
In [5]:
import prettyplotlib as ppl
import matplotlib.pyplot as plt
import numpy as np
import string
fig, ax = plt.subplots(1)
np.random.seed(14)
n = 10
ppl.bar(ax, np.arange(n), np.abs(np.random.randn(n)), annotate=True, xticklabels=string.uppercase[:n], grid='y')
fig.savefig('bar_prettyplotlib_grid_annotated_labeled.png')
In [ ]: