Stacked Scatter with Shading
Demonstrates how to combine filled scatter plots with vertical and horizontal offsets to achieve an interesting visual effect.
ScottPlot.Plot myPlot = new();
double[] xs = ScottPlot.Generate.Consecutive(100);
ScottPlot.Colormaps.MellowRainbow cmap = new();
for (int i = 0; i < 10; i++)
{
double yOffset = 9 - i * 0.5;
double[] ys = Generate.Sigmoidal(xs.Length)
.Select(y => y + yOffset)
.ToArray();
Generate.AddNoiseInPlace(ys, 0.1);
var sig = myPlot.Add.ScatterLine(xs, ys);
sig.LineColor = Colors.Black;
sig.LineWidth = 1.5f;
sig.FillY = true;
sig.FillYValue = yOffset;
sig.FillYAboveColor = cmap.GetColor(i, 10);
}
myPlot.HideGrid();
myPlot.Axes.MarginsX(0);
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Scatter Plot category
