Bar with Value Labels (horizontal)
Set the Label property of bars to have text displayed beside (left or right) of each bar.
ScottPlot.Plot myPlot = new();
double[] values = { -20, 10, 7, 13 };
// set the label for each bar
var barPlot = myPlot.Add.Bars(values);
foreach (var bar in barPlot.Bars)
{
bar.Label = "Label " + bar.Value.ToString();
}
// customize label style
barPlot.ValueLabelStyle.Bold = true;
barPlot.ValueLabelStyle.FontSize = 18;
barPlot.Horizontal = true;
// add extra margin to account for label
myPlot.Axes.SetLimitsX(-45, 35);
myPlot.Add.VerticalLine(0, 1, Colors.Black);
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Bar Plot category
