Setting a relative frequency in a matplotlib histogram
I have data as a list of floats and I want to plot it as a histogram. Hist() function does the job perfectly for plotting the absolute histogram. However, I cannot figure out how to represent it in a relative frequency format - I would like to have it as a fraction or ideally as a percentage on the y-axis. Here is the code: fig = plt.figure() ax = fig.add_subplot(111) n, bins, patches = ax.hist(mydata, bins=100, normed=1, cumulative=0) ax.set_xlabel('Bins', size=20) ax.set_ylabel('Frequency', size=20) ax.legend plt.show() I thought normed=1 argument would do it, but it gives fractions that are