I was looking at the examples on the matplotlib website trying to figure out how to create a density figure instead of just only a histogram.
The closest example I could find was the following which seems to completely defeat the purpose of the
density=True argument IMHO, because you’ll have to manually find the best fit for each plot.
Imagine I have hundreds of such plots then doing
# add a 'best fit' line y = ((1 / (np.sqrt(2 * np.pi) * sigma)) * np.exp(-0.5 * (1 / sigma * (bins - mu))**2)) ax.plot(bins, y, '--')
is far from optimal.
Wouldn’t it be better to actually have the argument
density=True create a density plot directly instead, and for instance if
density='both' in order to create a density plot overlaid over a histogram?