Skip to content Skip to sidebar Skip to footer

Plotting Histogram With Matplotlib

i try to plot data in a histogram or bar in python. The data size (array size) is between 0-10000. The data itself (each entry of the array) depends on the input and has a range be

Solution 1:

By default, hist produces a plot with an x range that covers the full range of your data. If you have one outsider at very high x in comparison with the other values, then you will see this image with a 'compressed' figure.

I you want to have always the same view you can fix the limits with xlim.
Alternatively, if you want to see your distribution always centered and as nicer as possible, you can calculate the mean and the standard deviation of your data and fix the x range accordingly (p.e. for mean +/- 5 stdev)


Post a Comment for "Plotting Histogram With Matplotlib"