public void ExecuteRecipe(Plot plt) { double[] xs = DataGen.Consecutive(51); double[] ys = DataGen.Sin(51); plt.AddScatterStep(xs, ys); }
public void ExecuteRecipe(Plot plt) { // create sample data for two datasets Random rand = new Random(0); double[] values1 = DataGen.RandomNormal(rand, pointCount: 1000, mean: 50, stdDev: 20); double[] values2 = DataGen.RandomNormal(rand, pointCount: 1000, mean: 45, stdDev: 25); (double[] hist1, double[] binEdges) = ScottPlot.Statistics.Common.Histogram(values1, min: 0, max: 100, binSize: 1, density: true); (double[] hist2, _) = ScottPlot.Statistics.Common.Histogram(values2, min: 0, max: 100, binSize: 1, density: true); double[] cph1 = ScottPlot.Statistics.Common.CumulativeSum(hist1); double[] cph2 = ScottPlot.Statistics.Common.CumulativeSum(hist2); double[] leftEdges = binEdges.Take(binEdges.Length - 1).ToArray(); // display datasets as step plots plt.AddScatterStep(xs: leftEdges, ys: cph1, label: "Sample A"); plt.AddScatterStep(xs: leftEdges, ys: cph2, label: "Sample B"); // decorate the plot plt.Legend(); plt.SetAxisLimits(yMin: 0, yMax: 1); plt.Title("Cumulative Probability Histogram"); plt.XAxis.Label("Probability (fraction)"); plt.YAxis.Label("Value (units)"); }