matplotlib - Python histogram with pre-set size of bins -


how go if wanted plot histogram when have bins , size ?

if use :

plt.hist(x, bins) 

it considers x list of results , not defined value of corresponding bin.

thanks

in case can create bar chart plt.bar:

plt.bar(bins[:, 0], x, bins[:, 1] - bins[:, 0]) 

i assumed bins array of shape (n, 2), nis number of bins. first column lowest value covered bin , second column upper value covered bin.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -