Answers for "matplotlib histogram bin width"

0

python - change the bin size of an histogram+

x = np.random.randn(1000)      # Generate random numbers
plt.hist(x, bins=20)           # Select bin size
plt.hist(x, bins=range(-4, 5)) # Select range
Posted by: Guest on July-06-2020
0

plt.hist using bins

counts, bins = np.histogram(data)
plt.hist(bins[:-1], bins, weights=counts)
Posted by: Guest on September-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language