GitHub Repo stars


Additional axes may be added to plots. Plottables are displayed using the coordinate system of the primary axes by default, but any plottable can be displayed using any X and Y axis.

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

// plottables use the standard X and Y axes by default
var sig1 = myPlot.Add.Signal(ScottPlot.Generate.Sin(51, mult: 0.01));
sig1.Axes.XAxis = myPlot.Axes.Bottom; // standard X axis
sig1.Axes.YAxis = myPlot.Axes.Left; // standard Y axis
myPlot.Axes.Left.Label.Text = "Primary Y Axis";

// create a second axis and add it to the plot
var yAxis2 = myPlot.Axes.AddLeftAxis();

// add a new plottable and tell it to use the custom Y axis
var sig2 = myPlot.Add.Signal(ScottPlot.Generate.Cos(51, mult: 100));
sig2.Axes.XAxis = myPlot.Axes.Bottom; // standard X axis
sig2.Axes.YAxis = yAxis2; // custom Y axis
yAxis2.Label.Text = "Secondary Y Axis";

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

Edit on GitHub