1) Install the ScottPlot.WinForms NuGet package
2) Drag a FormsPlot from the toolbox onto the form
Form1.cs
namespace WinFormsAppEx319 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void formsPlot1_Load(object sender, EventArgs e) { // generate some random X/Y data int pointCount = 1000; Random rand = new Random(0); double[] xs1 = ScottPlot.DataGen.RandomWalk(rand, pointCount); double[] ys1 = ScottPlot.DataGen.RandomWalk(rand, pointCount); double[] xs2 = ScottPlot.DataGen.RandomWalk(rand, pointCount); double[] ys2 = ScottPlot.DataGen.RandomWalk(rand, pointCount); // plot the data formsPlot1.Plot.PlotScatter(xs1, ys1); formsPlot1.Plot.PlotScatter(xs2, ys2); // additional styling formsPlot1.Plot.Title($"Scatter Plot ({pointCount} points per group)"); formsPlot1.Plot.XLabel("X"); formsPlot1.Plot.YLabel("Y"); formsPlot1.Refresh(); } } }
Recent Comments