ScottPlot.NET
GitHub Repo stars

Manual Legend Items

Legends may be constructed manually.

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

myPlot.Add.Signal(Generate.Sin(51));
myPlot.Add.Signal(Generate.Cos(51));
myPlot.Legend.IsVisible = true;

LegendItem item1 = new()
{
    LineColor = Colors.Magenta,
    MarkerColor = Colors.Magenta,
    LineWidth = 2,
    Label = "Alpha"
};

LegendItem item2 = new()
{
    LineColor = Colors.Green,
    MarkerColor = Colors.Green,
    LineWidth = 4,
    Label = "Beta"
};

LegendItem[] items = { item1, item2 };
myPlot.ShowLegend(items);

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

Edit on GitHub