Last active
August 28, 2019 22:12
-
-
Save heathhenley/2237984e43d5e751ce8d9b45d892a812 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 | |
x = np.random.rand(10) | |
_, _, patches = plt.hist(x, bins=3) | |
labels = ["label%d" % i for i in range(len(patches))] | |
for rect, label in zip(patches, labels): | |
height = rect.get_height() | |
plt.gca().text(rect.get_x() + rect.get_width() / 2, height, label, | |
ha='center', va='bottom') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment