Histogram of Probabilities
Histograms may be displayed as the probability for each value falling inside a bin
ScottPlot.Plot myPlot = new();
// Create a histogram from a collection of values
double[] heights = SampleData.MaleHeights();
var hist = ScottPlot.Statistics.Histogram.WithBinCount(10, heights);
// Display the histogram as a bar plot
var barPlot = myPlot.Add.Bars(hist.Bins, hist.GetProbability(100));
// Customize the style of each bar
foreach (var bar in barPlot.Bars)
{
bar.Size = hist.FirstBinSize * 0.8;
}
// Customize plot style
myPlot.Axes.Margins(bottom: 0);
myPlot.YLabel("Probability (%)");
myPlot.XLabel("Height (cm)");
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Histogram category
