Donut from Slices
A donut chart is a pie chart with an open center. Donut charts can be created from a collection of slices.
ScottPlot.Plot myPlot = new();
List<PieSlice> slices = new()
{
new PieSlice() { Value = 5, FillColor = Colors.Red, Label = "Red" },
new PieSlice() { Value = 2, FillColor = Colors.Orange, Label = "Orange" },
new PieSlice() { Value = 8, FillColor = Colors.Gold, Label = "Yellow" },
new PieSlice() { Value = 4, FillColor = Colors.Green, Label = "Green" },
new PieSlice() { Value = 8, FillColor = Colors.Blue, Label = "Blue" },
};
var pie = myPlot.Add.Pie(slices);
pie.DonutFraction = .5;
myPlot.ShowLegend();
// hide unnecessary plot components
myPlot.Axes.Frameless();
myPlot.HideGrid();
myPlot.SavePng("demo.png", 400, 300);
This recipe is one of many in the Pie category
