/gist:f4de96caa689123c9644 Secret
Last active
August 29, 2015 14:05
-
-
Save Ffisegydd/f4de96caa689123c9644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
calls = np.random.random_integers(100, 5000, 31) | |
days = np.arange(1, 32) | |
fig, ax = plt.subplots() | |
# Default width is already 0.8 but you can adjust it if you so wish | |
width = 0.8 | |
# Need to align center to make sure the ticks are directly below the bars | |
bar = ax.bar(days, calls, color='#4f7094', width=width, align='center') | |
ax.set_xticks(days) | |
for rect in bar[1::2]: | |
rect.set_color('#1e3046') | |
# Removes the spines around the border. | |
for spine in ['top', 'left', 'bottom', 'right']: | |
ax.spines[spine].set_visible(False) | |
# Removes unwanted ticks and labels | |
tick_args = dict(which='both', left='off', labelleft='off', right='off', | |
top='off', bottom='off', labelbottom='on') | |
plt.tick_params(**tick_args) | |
ax.set_xlim(0,32) | |
plt.tight_layout() # Sorts out the overlapping objects | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment