ScottPlot.NET
GitHub Repo stars

Line Plot Legend

Line plots with labels appear in the legend.

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

var sin = myPlot.Add.Signal(Generate.Sin());
sin.Label = "Sine";

var cos = myPlot.Add.Signal(Generate.Cos());
cos.Label = "Cosine";

var line = myPlot.Add.Line(1, 12, 12, 0);
line.LineWidth = 3;
line.MarkerSize = 10;
line.Label = "Line Plot";

myPlot.ShowLegend(Alignment.UpperRight);

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

Edit on GitHub