I have several arrays that contain measurement data of sensors. I would like to compare the frequency distribution of each array by plotting histograms with the help of matplotlib. My problem is, that the automatically scaled y-axis for each histogram differs, so that i can't compare them true to scale when i regard them side by side. On the following pictures in the links you can see, that the max value of the y axis is 18% on the green one and 30% on the gray one. In this case, I would like to have them automatically scaled by the highest percentage that occured: 30% green gray
Here is my code extract that I use to plot each of the histograms:
x = array_torque_VR
weights = 100*numpy.ones_like(x)/len(x) #maximum y-axis value is 100%
n, bins, patches = pyplot.hist(x, 20, weights=weights, facecolor='lime')
pyplot.xlabel('Torque in Nm')
pyplot.ylabel('Frequency in %')
I know, that it is possible to set a fixed max y-axis value by "pyplot.ylim()". But in my case it is important to get this value automatically scaled and i didn't find nothing to do so.
Do you think that there is a solution for this problem? Many thanks in advance for your help!