GitHub Repo stars

Population Quickstart

A Population can be created from a collection of values, styled as desired, and placed anywhere on the plot.

This code sample is specific to ScottPlot 5 (details)
ScottPlot.Plot myPlot = new();

for (int i = 0; i < 5; i++)
    double[] values = Generate.RandomNormal(10, mean: 3 + i);
    myPlot.Add.Population(values, x: i);

// make the bottom of the plot snap to zero by default
myPlot.Axes.Margins(bottom: 0);

// replace the default numeric ticks with custom ones
double[] tickPositions = Generate.Consecutive(5);
string[] tickLabels = Enumerable.Range(1, 5).Select(x => $"Group {x}").ToArray();
myPlot.Axes.Bottom.SetTicks(tickPositions, tickLabels);

// refine appearance of the plot
myPlot.Axes.Bottom.MajorTickStyle.Length = 0;
myPlot.Axes.Margins(bottom: 0);

myPlot.SavePng("demo.png", 400, 300);

Edit on GitHub