Text Offset
The offset properties can be used to fine-tune text position in pixel units
ScottPlot.Plot myPlot = new();
for (int i = 0; i < 25; i += 5)
{
// place a marker at the point
var marker = myPlot.Add.Marker(i, 1);
// place a styled text label at the point
var txt = myPlot.Add.Text($"{i}", i, 1);
txt.LabelFontSize = 16;
txt.LabelBorderColor = Colors.Black;
txt.LabelBorderWidth = 1;
txt.LabelPadding = 2;
txt.LabelBold = true;
txt.LabelBackgroundColor = marker.Color.WithAlpha(.5);
// offset the text label by the given number of pixels
txt.OffsetX = i;
txt.OffsetY = i;
}
myPlot.Axes.SetLimitsX(-5, 30);
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Text category
