Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
matplotlib recipes

histogram

import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
ax.hist(np.random.randn(10000), 20, label = 'series 1', alpha=0.3, color='r')
ax.hist(np.random.randn(10000), 20, label = 'series 2', alpha=0.3, color='b')
legend = ax.legend(loc = 'upper left')
plt.savefig('a.png')
plt.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment