This page is part of the ScottPlot 5.0 Cookbook
⚠️ ScottPlot 5.0.8-beta is a preview package
This page describes a beta release of ScottPlot. It is available on NuGet as a preview package, but its API is not stable and it is not recommended for production use. See the ScottPlot Versions page for more information.
Polygon Plot Quickstart
Polygon plots can be added from a series of vertices, and must be in clockwise order.
ScottPlot.Plot myPlot = new();
Coordinates[] vertices = new Coordinates[]
{
new Coordinates(0, 0.25),
new Coordinates(0.3, 0.75),
new Coordinates(1, 1),
new Coordinates(0.7, 0.5),
new Coordinates(1, 0)
};
myPlot.Add.Polygon(vertices);
myPlot.AutoScale();
myPlot.SavePng("polygon-plot-quickstart.png");
Polygon Plot Styling
Polygon plots can be fully customized.
ScottPlot.Plot myPlot = new();
Coordinates[] vertices = new Coordinates[]
{
new Coordinates(0, 0.25),
new Coordinates(0.3, 0.75),
new Coordinates(1, 1),
new Coordinates(0.7, 0.5),
new Coordinates(1, 0)
};
var poly = myPlot.Add.Polygon(vertices);
poly.FillStyle = new FillStyle
{
Color = Colors.IndianRed
};
poly.LineStyle = new LineStyle
{
AntiAlias = true,
Color = Colors.Black,
Pattern = LinePattern.Dash,
Width = 2
};
poly.MarkerStyle = new MarkerStyle(MarkerShape.OpenCircle, 8);
poly.MarkerStyle.Fill.Color = Colors.Gold;
poly.MarkerStyle.Outline.Color = Colors.Brown;
myPlot.AutoScale();
myPlot.SavePng("polygon-plot-styling.png");