Issue
I am plotting histogram where bin size is 10 each distributed from 1 to 100, now I have to plot these values of y= [1852, 1111, 1110, 1111, 741, 1482, 371, 370, 371, 1110] for each bin. Lets say for bin 0, I have 1825, bin1 I have 1111. on x-axis I have 1 to 100 while on y axis it goes to 10000. Tried the following code but not working.
y=[b0, b1,b2,b3,b4,b5,b6,b7,b8,b9]
plt.hist(y, bins=10)
Solution
Do you need matplotlib.pyplot.bar
>> import matplotlib.pyplot as plt
>>> x = range(10, 101, 10)
>>> plt.bar(x, y, width=9, tick_label=x)
<BarContainer object of 10 artists>
Output:
Answered By - Sayandip Dutta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.