ScottPlot is a free and open-source graphing library for .NET which makes it easy to display data in a variety of formats (line plots, bar charts, scatter plots, etc.) with just a few lines of code (see the ScottPlot Cookbook for examples). User controls are available for WinForms and WPF to allow interactive display of data.
NuGet Package | Target Framework(s) | Purpose |
---|---|---|
ScottPlot | .NET Standard 2.0 | Plot data and save or return a bitmap |
ScottPlot.WinForms | .NET Framework 4.6.1 .NET Core 3.0 |
User control for mouse-interactive plots |
ScottPlot.WPF | .NET Core 3.0 | User control for mouse-interactive plots |
ScottPlot 3.1.6 is the last version which supports .NET Framework 4.5
Solution files for quickstart examples are in /doc/quickstart
- Install the
ScottPlot
NuGet package - Add the following to your startup sequence:
double[] dataX = new double[] {1, 2, 3, 4, 5};
double[] dataY = new double[] {1, 4, 9, 16, 25};
var plt = new ScottPlot.Plot(600, 400);
plt.PlotScatter(dataX, dataY);
plt.SaveFig("quickstart.png");
Static plots can be useful in GUI applications, such as plotting on a Picturebox:
pictureBox1.Image = plt.GetBitmap();
- Install the
ScottPlot.WinForms
NuGet package - Drag/drop a FormsPlot user control onto the Form
- Add the following to the start-up sequence:
double[] dataX = new double[] {1, 2, 3, 4, 5};
double[] dataY = new double[] {1, 4, 9, 16, 25};
wpfPlot1.plt.PlotScatter(dataX, dataY);
formsPlot1.Render();
- Install the
ScottPlot.WPF
NuGet package - Add
<ScottPlot:WpfPlot Name="wpfPlot1"/>
to your XAML file - Add the following to the start-up sequence:
double[] dataX = new double[] {1, 2, 3, 4, 5};
double[] dataY = new double[] {1, 4, 9, 16, 25};
wpfPlot1.plt.PlotScatter(dataX, dataY);
wpfPlot1.Render();
Review the ScottPlot Cookbook to see what ScottPlot can do and learn how to use most of the ScottPlot features. Every in figure in the cookbook is displayed next to the code that was used to create it.
- Download the demos as a click-to-run EXE: ScottPlotDemos.zip
- Source code demos is in: /demos
- The demo project demonstrates advanced topics such as:
- Animated plots
- Plotting changing (or growing) data
- Draggable axis lines
- Show value on hover
- Realtime display of audio data (PCM and FFT)
ScottPlot was created by Scott Harden (Harden Technologies, LLC) with many contributions from the user community. To inquire about the development special features or customized versions of this software for consumer applications, contact the author at [email protected].