ScottPlot.NET
GitHub Repo stars

Colormap Gradient from Colors

Colormaps can be created as a gradient between a collection of colors.

ScottPlot.Plot myPlot = new();

Color[] colors = [Colors.Red, Colors.Magenta, Colors.DarkGreen];
IColormap myColormap = Colormap.FromColors(colors);

double[] xs = Generate.Consecutive(51);
double[] ys = Generate.Sin(51);
var markers = myPlot.Add.Markers(xs, ys);
markers.Colormap = myColormap;

myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Styling Plots category