public void ExecuteRecipe(Plot plt) { // Create and add Bar objects to the plot Random rand = new(0); List <ScottPlot.Plottable.Bar> bars = new(); for (int i = 0; i < 10; i++) { int value = rand.Next(25, 100); ScottPlot.Plottable.Bar bar = new() { Value = value, Position = i, FillColor = ScottPlot.Palette.Category10.GetColor(i), LineWidth = 2, }; bars.Add(bar); } ; plt.AddBarSeries(bars); // Add error bars on top of the BarSeries plot double[] xs = bars.Select(x => x.Position).ToArray(); double[] xErrs = bars.Select(x => (double)0).ToArray(); double[] ys = bars.Select(x => x.Value).ToArray(); double[] yErrs = bars.Select(x => (double)rand.Next(2, 20)).ToArray(); var err = plt.AddErrorBars(xs, ys, xErrs, yErrs); err.LineWidth = 2; err.CapSize = 5; err.LineColor = Color.Black; plt.SetAxisLimitsY(0, 120); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 50; double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.NoisyBellCurve(rand, pointCount); double[] yErr = DataGen.Random(rand, pointCount, multiplier: .2, offset: .05); plt.AddErrorBars(xs, ys, null, yErr, markerSize: 5); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 20; double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.RandomNormal(rand, pointCount, mean: 20, stdDev: 2); double[] yErr = DataGen.RandomNormal(rand, pointCount).Select(e => Math.Abs(e)).ToArray(); plt.AddScatter(xs, ys, System.Drawing.Color.Blue, lineStyle: LineStyle.Dot); plt.AddErrorBars(xs, ys, null, yErr, System.Drawing.Color.Blue); }