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) { // Create a collection of Bar objects 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() { // Each bar can be extensively customized Value = value, Position = i, FillColor = ScottPlot.Palette.Category10.GetColor(i), Label = value.ToString(), LineWidth = 2, }; bars.Add(bar); } ; // Add the BarSeries to the plot plt.AddBarSeries(bars); plt.SetAxisLimitsY(0, 120); }
public void ExecuteRecipe(Plot plt) { 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), Label = value.ToString(), IsVertical = false, // ENABLE HORIZONTAL ORIENTATION }; bars.Add(bar); } ; plt.AddBarSeries(bars); plt.SetAxisLimitsX(0, 120); }