ScottPlot.NET
How to create a plot and save it as an image from a C# console application

Step 1: Install the current ScottPlot 4 package from NuGet. Linux & MacOS users may need to install additional packages.

Step 2: Plot some data and save the figure as an image file

double[] dataX = new double[] { 1, 2, 3, 4, 5 };
double[] dataY = new double[] { 1, 4, 9, 16, 25 };

var myPlot = new ScottPlot.Plot(400, 300);
myPlot.AddScatter(dataX, dataY);

myPlot.SaveFig("quickstart.png");

⚠️ WARNING: ScottPlot 5 has not yet been released. ScottPlot 5 preview packages are available on NuGet for experimentation. ScottPlot 5 is being actively developed, but it is not yet feature complete, fully documented, supported, or recommended for production use at this time. See the ScottPlot versions page for more information.
double[] dataX = { 1, 2, 3, 4, 5 };
double[] dataY = { 1, 4, 9, 16, 25 };

ScottPlot.Plot myPlot = new(400, 300);
myPlot.Add.Scatter(dataX, dataY);

myPlot.SavePng("quickstart.png")

Interactive Window

Plots created in console applications can be launched in a pop-up window allowing interactive pan and zoom.

Step 1: Install the current ScottPlot.WinForms package (or WPF, Eto, etc.)

Step 2: Create a Plot and populate it with data

Step 3: Create a PlotViewer and Show() it

double[] dataX = { 1, 2, 3, 4, 5 };
double[] dataY = { 1, 4, 9, 16, 25 };

ScottPlot.Plot myPlot = new(400, 300);
myPlot.AddScatter(dataX, dataY);

new ScottPlot.FormsPlotViewer(myPlot).ShowDialog();

💡 Interactive plots using the WinForms and WPF controls require the console application to target Windows, but a strategy for launching interactive plots from console applications running on Linux using Avalonia is described in #1769