Home > Sample Charts > Histogram > Overlayed Normal Curve

Overlayed Normal Curve

The Histogram does one very simple job – it takes a large sample of values and shows how they are grouped. Many samples of data turn out to follow a bell-shaped curve called the Normal distribution, but often the shape of the plot gives some useful clues which can be hidden simply by looking at statistics such as the Mean or Range.

The final example draws a theoretical bellcurve centred on the mean. In this case (the data is the sum of 3 dice throws) we confidently expect a Normal distribution. For many datasets, it will be necessary to compute a more complex theoretical curve and overlay it with a call to LineGraph as an indepentent secondary chart.


SharpPlot sp = new SharpPlot;

sp.Heading = "Histogram with Normal curve";
sp.HistogramStyle = HistogramStyles.SurfaceShading|HistogramStyles.Risers|
         HistogramStyles.NormalCurve;
sp.SetFillStyles(FillStyle.Halftone);
sp.SetPenWidths(2);

sp.SetXRange(3,18);
sp.ClassInterval = 3;
sp.SetXTickMarks(3);

sp.DrawHistogram(threedice);

Worked Examples

histogram1 histogram2 histogram3 histogram4

Send comments on this topic
© Dyalog Ltd 2013