MATLAB: How to create a plot with a histogram in the same graph

mathematicsMATLABstatisticsStatistics and Machine Learning Toolbox

Hi,
I want to create a plot of a distribution with a histogram together in the same plot.i'v only been able to plot them separately.
thanks in advance

Best Answer

The histogram is the distribution. Please explain. If you want to plot a curve - some curve representing the theoretical distribution rather than the actual distribution like what the histogram is, then call "hold on" after you call bar() to plot your histogram and before you call plot() to plot the curve:
bar(binCenters, countData);
hold on;
plot(x, theoreticalCurve, 'bo-');
Related Question