ScottPlot.NET
GitHub Repo stars

Range Chart

A range chart displays a discrete set of named value ranges

ScottPlot.Plot myPlot = new();

List<(string name, CoordinateRange range)> ranges =
[
    ("Africa", new(-35, 37)),
    ("Antarctica", new(-90, -60)),
    ("Asia", new(-11, 81)),
    ("Europe", new(-36, 71)),
    ("North America", new(-7, 83)),
    ("South America", new(-56, 13)),
    ("Australia", new(-47, -28)),
];
myPlot.Add.Ranges(ranges);

// style the axes
myPlot.Title("Latitude Range of the Continents");
myPlot.Axes.Bottom.TickLabelStyle.Rotation = -45;
myPlot.Axes.Bottom.TickLabelStyle.Alignment = Alignment.MiddleRight;
myPlot.Axes.Bottom.MinimumSize = 100;

// use tick labels with a degree symbol
ScottPlot.TickGenerators.NumericAutomatic tickGen = new();
myPlot.Axes.Left.TickGenerator = tickGen;
tickGen.LabelFormatter = (x) => $"{x}º";

// add a horizontal line at zero and push it beneath the range plot
var hl = myPlot.Add.HorizontalLine(0, 1, Colors.Black, LinePattern.DenselyDashed);
myPlot.MoveToBack(hl);

myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Bar Plot category