Created
July 28, 2017 10:17
-
-
Save swateek/422ddb850274c07a6fabf825cb1a2f05 to your computer and use it in GitHub Desktop.
Plotting a Histogram with bucket sizes
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 numpy as np | |
import matplotlib.pyplot as plt | |
hist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5)) | |
plt.bar(bin_edges[:-1], hist, width = 1) | |
plt.xlim(min(bin_edges), max(bin_edges)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment