Histogram Bars
A helper method and plot type has been created to simplify creating a bar plot that displays histogram counts. Note that updates the histogram may appear in real time and the plot will automatically update to display the latest data, but axis limits must be recalculated after new data is added.
ScottPlot.Plot myPlot = new();
// create an empty histogram and display it as a bar plot
var hist = ScottPlot.Statistics.Histogram.WithBinCount(count: 20, minValue: 140, maxValue: 220);
var histPlot = myPlot.Add.Histogram(hist);
histPlot.BarWidthFraction = 0.8;
// histogram counts are updated automatically as new data is added,
// but autoscaling must be applied after the counts change.
double[] newData = SampleData.MaleHeights();
hist.AddRange(newData);
myPlot.Axes.AutoScaleY();
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Histogram category
