ScottPlot.NET
GitHub Repo stars

Text Offset

The offset properties can be used to fine-tune text position in pixel units

This code sample is specific to ScottPlot 5 (details)
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.FontSize = 16;
    txt.BorderColor = Colors.Black;
    txt.BorderWidth = 1;
    txt.Padding = 2;
    txt.Bold = true;
    txt.BackColor = 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);

Edit on GitHub