Annotation
Annotations are labels you can place on the data area of a plot. Unlike Text added to the plot (which is placed in coordinate units on the axes), Annotations are positioned relative to the data area (in pixel units) and do not move as the plot is panned and zoomed.
ScottPlot.Plot myPlot = new();
myPlot.Add.Signal(Generate.Sin());
myPlot.Add.Signal(Generate.Cos());
myPlot.Add.Annotation("This is an Annotation");
myPlot.SavePng("demo.png", 400, 300);
Annotations can be extensively customized.
ScottPlot.Plot myPlot = new();
myPlot.Add.Signal(Generate.Sin());
myPlot.Add.Signal(Generate.Cos());
var anno = myPlot.Add.Annotation("Customized\nAnnotation");
anno.LabelFontSize = 32;
anno.LabelFontName = Fonts.Serif;
anno.LabelBackgroundColor = Colors.RebeccaPurple.WithAlpha(.3);
anno.LabelFontColor = Colors.RebeccaPurple;
anno.LabelBorderColor = Colors.Green;
anno.LabelBorderWidth = 3;
anno.LabelShadowColor = Colors.Transparent;
anno.OffsetY = 40;
anno.OffsetX = 20;
myPlot.SavePng("demo.png", 400, 300);
Annotations are aligned with the data area.
ScottPlot.Plot myPlot = new();
foreach (Alignment alignment in Enum.GetValues(typeof(Alignment)))
{
myPlot.Add.Annotation(alignment.ToString(), alignment);
}
myPlot.SavePng("demo.png", 400, 300);


