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)
, n
is number of bins. first column lowest value covered bin , second column upper value covered bin.
Comments
Post a Comment