Skip to content

Instantly share code, notes, and snippets.

@aphlysia
Created October 31, 2013 02:26
Show Gist options
  • Save aphlysia/7243526 to your computer and use it in GitHub Desktop.
Save aphlysia/7243526 to your computer and use it in GitHub Desktop.
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