/// <summary> /// Scatter plot features /// </summary> public static void demo_006() { // create a new ScottPlot figure var fig = new ScottPlot.Figure(640, 480); fig.labelTitle = "Super Special Data"; fig.labelY = "Random Walk"; fig.labelX = "Sample Number"; // generate data int pointCount = 40; double[] Xs = fig.gen.Sequence(pointCount); // manually define axis fig.AxisSet(-3, 43, -2, 4); // make the plot fig.BenchmarkThis(); fig.PlotScatter(Xs, fig.gen.RandomWalk(pointCount), 2, Color.Black); fig.PlotScatter(Xs, fig.gen.RandomWalk(pointCount), 5, Color.Red); fig.PlotScatter(Xs, fig.gen.RandomWalk(pointCount), 10, Color.Green); fig.PlotScatter(Xs, fig.gen.RandomWalk(pointCount), 20, Color.FromArgb(100, 0, 0, 255)); // save the file fig.Save("output/demo_006.png"); }
/// <summary> /// Create a plot of data from two arrays of doubles (Xs and Ys) /// </summary> public static void demo_001() { // create a new ScottPlot figure var fig = new ScottPlot.Figure(640, 480); fig.labelTitle = "Super Special Data"; fig.labelY = "Random Walk"; fig.labelX = "Sample Number"; // generate data int pointCount = 123; double[] Xs = fig.gen.Sequence(pointCount); double[] Ys = fig.gen.RandomWalk(pointCount); // adjust the axis to fit the data (then zoom out slightly) fig.AxisAuto(Xs, Ys, .9, .9); // make the plot fig.BenchmarkThis(); fig.PlotLines(Xs, Ys, 1, Color.Red); fig.PlotScatter(Xs, Ys, 5, Color.Blue); // save the file fig.Save("output/demo_001.png"); }
public void ResizeAndRedraw() { if (fig == null) { return; } fig.Resize(pictureBox1.Width, pictureBox1.Height); fig.FrameRedraw(); fig.PlotLines(Xs, Ys, 1, Color.Red); fig.PlotScatter(Xs, Ys, 5, Color.Blue); pictureBox1.Image = fig.Render(); }
/// <summary> /// Zooming /// </summary> public static void demo_002() { var fig = new ScottPlot.Figure(640, 480); fig.labelTitle = "Super Special Data"; fig.labelY = "Random Walk"; fig.labelX = "Sample Number"; double[] Xs = fig.gen.Sequence(123); double[] Ys = fig.gen.RandomWalk(123); fig.AxisAuto(Xs, Ys, null, null); // fit data precisely fig.Zoom(2, .5); // now zoom in horizontally and out vertically fig.PlotLines(Xs, Ys, 1, Color.Red); fig.PlotScatter(Xs, Ys, 5, Color.Blue); fig.Save("output/demo_002.png"); }
private void button1_Click(object sender, EventArgs e) { var fig = new ScottPlot.Figure(pictureBox1.Width, pictureBox1.Height); fig.styleForm(); // optimizes colors for forms fig.labelTitle = "Plotting Point Arrays"; fig.labelY = "Random Walk"; fig.labelX = "Sample Number"; // generate data int pointCount = 123; double[] Xs = fig.gen.Sequence(pointCount); double[] Ys = fig.gen.RandomWalk(pointCount); fig.AxisAuto(Xs, Ys, .9, .9); // make the plot //fig.BenchmarkThis(); fig.PlotLines(Xs, Ys, 1, Color.Red); fig.PlotScatter(Xs, Ys, 5, Color.Blue); pictureBox1.Image = fig.Render(); }
/// <summary> /// Changing colors /// </summary> public static void demo_003() { var fig = new ScottPlot.Figure(640, 480); fig.labelTitle = "Super Special Data"; fig.labelY = "Random Walk"; fig.labelX = "Sample Number"; // go to town changing colors fig.colorAxis = Color.Yellow; fig.colorFigBg = Color.FromArgb(255, 30, 30, 30); fig.colorGridLines = Color.FromArgb(255, 55, 55, 55); fig.colorGraphBg = Color.FromArgb(255, 40, 40, 40); double[] Xs = fig.gen.Sequence(123); double[] Ys = fig.gen.RandomWalk(123); fig.AxisAuto(Xs, Ys, .9, .9); fig.BenchmarkThis(); fig.PlotLines(Xs, Ys, 1, Color.Gray); fig.PlotScatter(Xs, Ys, 5, Color.White); fig.Save("output/demo_003.png"); }