ScottPlot.NET
GitHub Repo stars

Polygon Plot Styling

Polygon plots can be fully customized.

This code sample is specific to ScottPlot 5 (details)
ScottPlot.Plot myPlot = new();

Coordinates[] points =
{
    new (0, 0.25),
    new (0.3, 0.75),
    new (1, 1),
    new (0.7, 0.5),
    new (1, 0)
};

var poly = myPlot.Add.Polygon(points);

poly.FillStyle = new FillStyle
{
    Color = Colors.Green,
    HatchColor = Colors.Blue,
    Hatch = new Gradient()
    {
        GradientType = GradientType.Linear,
        AlignmentStart = Alignment.UpperRight,
        AlignmentEnd = Alignment.LowerLeft,
    }
};

poly.LineStyle = new LineStyle
{
    AntiAlias = true,
    Color = Colors.Black,
    Pattern = LinePattern.Dashed,
    Width = 2
};

poly.MarkerStyle = new MarkerStyle(MarkerShape.OpenCircle, 8);
poly.MarkerStyle.Fill.Color = Colors.Gold;
poly.MarkerStyle.Outline.Color = Colors.Brown;

myPlot.SavePng("demo.png", 400, 300);

Edit on GitHub