Scatter Plot with Gradient Fill
The area beneath a scatter plot can be filled with a custom gradient of colors.
ScottPlot.Plot myPlot = new();
double[] xs = Generate.Consecutive(51);
double[] ys = Generate.Sin(51);
var poly = myPlot.Add.ScatterLine(xs, ys);
poly.FillY = true;
// colors are placed at specific positions on the X axis
poly.AxisGradientDirection = AxisGradientDirection.Horizontal;
poly.ColorPositions.Add(new(Colors.Red, 0));
poly.ColorPositions.Add(new(Colors.Orange, 10));
poly.ColorPositions.Add(new(Colors.Yellow, 20));
poly.ColorPositions.Add(new(Colors.Green, 30));
poly.ColorPositions.Add(new(Colors.Blue, 40));
poly.ColorPositions.Add(new(Colors.Violet, 50));
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Scatter Plot category
