public void Render(Plot plt) { // create some sample data to represent test scores Random rand = new Random(0); double[] scoresA = DataGen.RandomNormal(rand, 35, 85, 5); double[] scoresB = DataGen.RandomNormal(rand, 42, 87, 3); double[] scoresC = DataGen.RandomNormal(rand, 23, 92, 3); // collect multiple populations into a PopulationSeries var poulations = new Statistics.Population[] { new Statistics.Population(scoresA), new Statistics.Population(scoresB), new Statistics.Population(scoresC) }; // Plot these as a single series (all styled the same, appearing once in legend) var popSeries = new Statistics.PopulationSeries(poulations); plt.PlotPopulations(popSeries, "scores"); // improve the style of the plot plt.Title($"Test Scores by Class"); plt.YLabel("Score"); plt.XTicks(new string[] { "Class A", "Class B", "Class C" }); plt.Legend(); plt.Grid(lineStyle: LineStyle.Dot, enableVertical: false); }
public void Render(Plot plt) { // generate random data to plot Random rand = new Random(0); int pointCount = 10; double[] xs = DataGen.Consecutive(pointCount); double[] ys1 = DataGen.RandomNormal(rand, pointCount, 20, 5); double[] ys2 = DataGen.RandomNormal(rand, pointCount, 20, 5); double[] err1 = DataGen.RandomNormal(rand, pointCount, 5, 2); double[] err2 = DataGen.RandomNormal(rand, pointCount, 5, 2); // add both bar plots with a careful widths and offsets plt.PlotBar(xs, ys1, err1, "data A", barWidth: .3, xOffset: -.2); plt.PlotBar(xs, ys2, err2, "data B", barWidth: .3, xOffset: .2); // customize the plot to make it look nicer plt.Axis(y1: 0); plt.Grid(enableVertical: false, lineStyle: LineStyle.Dot); plt.Axis(y1: 0); plt.Legend(location: legendLocation.upperRight); // apply custom axis tick labels string[] labels = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" }; plt.XTicks(xs, labels); }
public void Test_Bar_MultiSeries() { Random rand = new Random(0); string[] groupNames = { "one", "two", "three", "four", "five" }; string[] seriesNames = { "alpha", "beta", "gamma" }; int groupCount = groupNames.Length; double[] xs = DataGen.Consecutive(groupCount); double[] ys1 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] ys2 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] ys3 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] err1 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] err2 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] err3 = DataGen.RandomNormal(rand, groupCount, 5, 2); var plt = new ScottPlot.Plot(600, 400); plt.PlotBarGroups( groupLabels: groupNames, seriesLabels: seriesNames, ys: new double[][] { ys1, ys2, ys3 }, yErr: new double[][] { err1, err2, err3 }); plt.Axis(y1: 0); plt.Grid(enableVertical: false, lineStyle: LineStyle.Dot); plt.Legend(location: Alignment.UpperRight); TestTools.SaveFig(plt); }
public void ExecuteRecipe(Plot plt) { // create an extremely noisy signal with a subtle sine wave beneath it Random rand = new Random(0); int pointCount = 100_000; double[] signal1 = DataGen.Sin(pointCount, 3); double[] noise = DataGen.RandomNormal(rand, pointCount, 0, 5); double[] data = new double[pointCount]; for (int i = 0; i < data.Length; i++) { data[i] = signal1[i] + noise[i]; } // plot the noisy signal using the traditional method var sp1 = plt.AddSignal(data); sp1.OffsetY = -40; sp1.Color = Color.Red; // use a custom colors to display data of different densities string[] colorCodes = { "#440154", "#39568C", "#1F968B", "#73D055" }; Color[] colors = colorCodes.Select(x => ColorTranslator.FromHtml(x)).ToArray(); var sp2 = plt.AddSignal(data); sp2.DensityColors = colors; plt.Title("Color by Density vs. Solid Color"); plt.AxisAuto(0, .1); }
public void Render(Plot plt) { // generate random data to plot string[] groupNames = { "one", "two", "three", "four", "five" }; string[] seriesNames = { "alpha", "bravo", "charley" }; int groupCount = groupNames.Length; Random rand = new Random(0); double[] ys1 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] ys2 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] ys3 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] err1 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] err2 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] err3 = DataGen.RandomNormal(rand, groupCount, 5, 2); plt.PlotBarGroups( groupLabels: groupNames, seriesLabels: seriesNames, ys: new double[][] { ys1, ys2, ys3 }, yErr: new double[][] { err1, err2, err3 }); // customize the plot to make it look nicer plt.Grid(enableVertical: false, lineStyle: LineStyle.Dot); plt.Legend(location: legendLocation.upperRight); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); double[] values = DataGen.RandomNormal(rand, pointCount: 1000, mean: 50, stdDev: 20); var hist = new ScottPlot.Statistics.Histogram(values, min: 0, max: 100); // plot the bins as a bar graph (on the primary Y axis) var bar = plt.AddBar(hist.counts, hist.bins); bar.BarWidth = hist.binSize * 1.2; // oversize to reduce render artifacts bar.BorderLineWidth = 0; bar.YAxisIndex = 0; plt.YAxis.Label("Count (#)"); plt.YAxis.Color(bar.FillColor); // plot the mean curve as a scatter plot (on the secondary Y axis) var sp = plt.AddScatter(hist.bins, hist.countsFracCurve); sp.MarkerSize = 0; sp.LineWidth = 2; sp.YAxisIndex = 1; plt.YAxis2.Label("Fraction"); plt.YAxis2.Color(sp.Color); plt.YAxis2.Ticks(true); // decorate the plot plt.XAxis2.Label("Normal Random Data", bold: true); plt.XAxis.Label("Value (units)"); plt.SetAxisLimits(yMin: 0); plt.Grid(lineStyle: LineStyle.Dot); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 1_000_000; double[] sine = DataGen.Sin(pointCount, 3); double[] noise = DataGen.RandomNormal(rand, pointCount, 0, 0.5); double[] ys = sine.Zip(noise, (s, n) => s + n).ToArray(); double[] xs = new double[pointCount]; double currentX = 0; for (int i = 0; i < pointCount; i++) { if ((i % 100000) < 10) { currentX += 10; } else { currentX += 0.0001; } xs[i] = currentX; } plt.AddSignalXY(xs, ys); }
public static Plot CreateAdvancedStatisticsPlot() { var plt = new ScottPlot.Plot(600, 400); // create some sample data to represent test scores Random rand = new Random(0); double[] scores = DataGen.RandomNormal(rand, 250, 85, 5); // create a Population object from the data var pop = new ScottPlot.Statistics.Population(scores); // display the original values scattered vertically double[] ys = DataGen.RandomNormal(rand, pop.values.Length, stdDev: .15); plt.PlotScatter(pop.values, ys, markerSize: 10, markerShape: MarkerShape.openCircle, lineWidth: 0); // display the bell curve for this distribution double[] curveXs = DataGen.Range(pop.minus3stDev, pop.plus3stDev, .1); double[] curveYs = pop.GetDistribution(curveXs); plt.PlotScatter(curveXs, curveYs, markerSize: 0, lineWidth: 2); // improve the style of the plot plt.Title($"Test Scores (mean: {pop.mean:0.00} +/- {pop.stDev:0.00}, n={pop.n})"); plt.XLabel("Score"); plt.Grid(lineStyle: LineStyle.Dot); return(plt); //plt.SaveFig("Advanced_Statistics_Population.png"); }
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); var hist1 = new ScottPlot.Statistics.Histogram(values1, min: 0, max: 100); var hist2 = new ScottPlot.Statistics.Histogram(values2, min: 0, max: 100); // display datasets as step plots var sp1 = plt.AddScatter(hist1.bins, hist1.cumulativeFrac); sp1.Label = "Sample A"; sp1.StepDisplay = true; sp1.MarkerSize = 0; var sp2 = plt.AddScatter(hist2.bins, hist2.cumulativeFrac); sp2.Label = "Sample B"; sp2.StepDisplay = true; sp2.MarkerSize = 0; // decorate the plot plt.Legend(); plt.SetAxisLimits(yMin: 0, yMax: 1); plt.Grid(lineStyle: LineStyle.Dot); plt.Title("Cumulative Probability Histogram"); plt.XAxis.Label("Probability (fraction)"); plt.YAxis.Label("Value (units)"); }
public void ExecuteRecipe(Plot plt) { // create sample data to represent test scores Random rand = new Random(0); double[] valuesA = DataGen.RandomNormal(rand, 35, 85, 5); double[] valuesB = DataGen.RandomNormal(rand, 42, 87, 3); double[] valuesC = DataGen.RandomNormal(rand, 23, 92, 3); // create population objects for each set of data values var popA = new Statistics.Population(valuesA); var popB = new Statistics.Population(valuesB); var popC = new Statistics.Population(valuesC); // combine several populations into an array and plot it var poulations = new Statistics.Population[] { popA, popB, popC }; string[] populationNames = { "Group A", "Group B", "Group C" }; // customize the data display format var popPlot = plt.AddPopulations(poulations); popPlot.DistributionCurve = false; popPlot.DataFormat = ScottPlot.Plottable.PopulationPlot.DisplayItems.ScatterOnBox; popPlot.DataBoxStyle = ScottPlot.Plottable.PopulationPlot.BoxStyle.BarMeanStDev; // improve the style of the plot plt.XAxis.Grid(false); plt.XTicks(populationNames); }
public void ExecuteRecipe(Plot plt) { // generate random data to plot int groupCount = 5; Random rand = new(0); double[] values1 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] values2 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] values3 = DataGen.RandomNormal(rand, groupCount, 20, 5); double[] errors1 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] errors2 = DataGen.RandomNormal(rand, groupCount, 5, 2); double[] errors3 = DataGen.RandomNormal(rand, groupCount, 5, 2); // group all data together string[] groupNames = { "Group A", "Group B", "Group C", "Group D", "Group E" }; string[] seriesNames = { "Series 1", "Series 2", "Series 3" }; double[][] valuesBySeries = { values1, values2, values3 }; double[][] errorsBySeries = { errors1, errors2, errors3 }; // add the grouped bar plots and show a legend plt.AddBarGroups(groupNames, seriesNames, valuesBySeries, errorsBySeries); plt.Legend(location: Alignment.UpperRight); // adjust axis limits so there is no padding below the bar graph plt.SetAxisLimits(yMin: 0); }
public void Render(Plot plt) { Random rand = new Random(0); int pointCount = 20; // random data points double[] dataX = DataGen.Consecutive(pointCount); double[] dataY1 = DataGen.Sin(pointCount, offset: 6); double[] dataY2 = DataGen.Sin(pointCount, offset: 3); double[] dataY3 = DataGen.Sin(pointCount, offset: 0); // random errorbar sizes double[] errorYPositive = DataGen.RandomNormal(rand, pointCount); double[] errorXPositive = DataGen.RandomNormal(rand, pointCount); double[] errorYNegative = DataGen.RandomNormal(rand, pointCount); double[] errorXNegative = DataGen.RandomNormal(rand, pointCount); // plot different combinations of errorbars plt.PlotErrorBars(dataX, dataY1, errorXPositive, errorXNegative, errorYPositive, errorYNegative, label: "Asymmetric X and Y errors"); plt.PlotErrorBars(dataX, dataY2, errorXPositive, null, errorYPositive, null, label: "Positive errors only"); plt.PlotErrorBars(dataX, dataY3, null, errorXNegative, null, errorYNegative, label: $"Negative errors only"); plt.Title("Error Bars with Asymmetric X and Y Values"); plt.Grid(false); plt.Legend(); }
public void Render(Plot plt) { // create some sample data to represent test scores Random rand = new Random(0); double[] scoresA = DataGen.RandomNormal(rand, 35, 85, 5); double[] scoresB = DataGen.RandomNormal(rand, 42, 87, 3); double[] scoresC = DataGen.RandomNormal(rand, 23, 92, 3); // create a unique PopulationSeries for each set of scores var seriesA = new Statistics.PopulationSeries(new Statistics.Population[] { new Statistics.Population(scoresA) }, "Class A"); var seriesB = new Statistics.PopulationSeries(new Statistics.Population[] { new Statistics.Population(scoresB) }, "Class B"); var seriesC = new Statistics.PopulationSeries(new Statistics.Population[] { new Statistics.Population(scoresC) }, "Class C"); // create a MultiSeries from all the individual series var multiSeries = new Statistics.PopulationMultiSeries(new Statistics.PopulationSeries[] { seriesA, seriesB, seriesC }); plt.PlotPopulations(multiSeries); // improve the style of the plot plt.Title($"Test Scores by Class"); plt.YLabel("Score"); plt.Ticks(displayTicksX: false); plt.Legend(); plt.Grid(lineStyle: LineStyle.Dot, enableVertical: false); }
public void Render(Plot plt) { Random rand = new Random(0); int pointCount = 20; // random data points double[] dataX = DataGen.Consecutive(pointCount); double[] dataY1 = DataGen.RandomNormal(rand, pointCount, mean: 20, stdDev: 2); double[] dataY2 = DataGen.RandomNormal(rand, pointCount, mean: 10, stdDev: 2); double[] dataY3 = DataGen.RandomNormal(rand, pointCount, mean: 0, stdDev: 2); // random errorbar sizes double[] errorYPositive = DataGen.RandomNormal(rand, pointCount); double[] errorXPositive = DataGen.RandomNormal(rand, pointCount); double[] errorYNegative = DataGen.RandomNormal(rand, pointCount); double[] errorXNegative = DataGen.RandomNormal(rand, pointCount); // plot different combinations of errorbars var err1 = plt.PlotErrorBars(dataX, dataY1, errorXPositive, errorXNegative, errorYPositive, errorYNegative); var err2 = plt.PlotErrorBars(dataX, dataY2, errorXPositive, null, errorYPositive, null); var err3 = plt.PlotErrorBars(dataX, dataY3, null, errorXNegative, null, errorYNegative); // draw scatter plots on top of the errorbars plt.PlotScatter(dataX, dataY1, color: err1.Color, label: "Both"); plt.PlotScatter(dataX, dataY2, color: err2.Color, label: "Positive"); plt.PlotScatter(dataX, dataY3, color: err3.Color, label: $"Negative"); plt.Title("Error Bars with Asymmetric X and Y Values"); plt.Grid(false); plt.Legend(); }
public void ExecuteRecipe(Plot plt) { double[] values = DataGen.RandomNormal(0, 12, 5, 10); double[] offsets = Enumerable.Range(0, values.Length).Select(x => values.Take(x).Sum()).ToArray(); var bar = plt.AddBar(values); bar.ValueOffsets = offsets; bar.FillColorNegative = Color.Red; bar.FillColor = Color.Green; }
public void Render(Plot plt) { Random rand = new Random(0); //Some noisy data centred around the middle int[] xs = DataGen.RandomNormal(rand, 10000, 25, 10).Select(x => (int)x).ToArray(); int[] ys = DataGen.RandomNormal(rand, 10000, 25, 10).Select(y => (int)y).ToArray(); //Each cell is a square with side-length of 4 double[,] intensities = Tools.XYToIntensities(Tools.IntensityMode.density, xs, ys, 50, 50, 4); plt.PlotHeatmap(intensities); }
public void Render(Plot plt) { Random rand = new Random(0); //Some noisy data centred around the middle int[] xs = DataGen.RandomNormal(rand, 10000, 25, 10).Select(x => (int)x).ToArray(); int[] ys = DataGen.RandomNormal(rand, 10000, 25, 10).Select(y => (int)y).ToArray(); //Standard Deviation of 4 double[,] intensities = Tools.XYToIntensities(Tools.IntensityMode.gaussian, xs, ys, 50, 50, 4); plt.PlotHeatmap(intensities); }
public static void PlotHeatmapGaussianNoise(Plot plt, Colormap cmap) { Random rand = new Random(0); int[] xs = DataGen.RandomNormal(rand, 10000, 25, 10).Select(x => (int)x).ToArray(); int[] ys = DataGen.RandomNormal(rand, 10000, 25, 10).Select(y => (int)y).ToArray(); double[,] intensities = Tools.XYToIntensities(Tools.IntensityMode.gaussian, xs, ys, 50, 50, 4); plt.Clear(); plt.PlotHeatmap(intensities, cmap); plt.AxisAuto(); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int[] xs = DataGen.RandomNormal(rand, 10000, 25, 10).Select(x => (int)x).ToArray(); int[] ys = DataGen.RandomNormal(rand, 10000, 25, 10).Select(y => (int)y).ToArray(); double[,] intensities = Tools.XYToIntensities(mode: IntensityMode.Gaussian, xs: xs, ys: ys, width: 50, height: 50, sampleWidth: 4); var hm = plt.AddHeatmap(intensities); var cb = plt.AddColorbar(hm); }
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); }
public void Render(Plot plt) { Random rand = new Random(0); double[] values = DataGen.RandomNormal(rand, pointCount: 1000, mean: 50, stdDev: 20); var hist = new Statistics.Histogram(values, min: 0, max: 100); plt.PlotBar(hist.bins, hist.countsFrac); plt.PlotScatter(hist.bins, hist.countsFracCurve, markerSize: 0, lineWidth: 2, color: Color.Black); plt.Title("Normal Random Data"); plt.YLabel("Frequency (fraction)"); plt.XLabel("Value (units)"); plt.Axis(null, null, 0, null); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 51; double[] xs1 = DataGen.RandomNormal(rand, pointCount, 1); double[] xs2 = DataGen.RandomNormal(rand, pointCount, 3); double[] ys1 = DataGen.RandomNormal(rand, pointCount, 5); double[] ys2 = DataGen.RandomNormal(rand, pointCount, 7); plt.AddScatter(xs1, ys1, markerSize: 0, label: "lines only"); plt.AddScatter(xs2, ys2, lineWidth: 0, label: "markers only"); plt.Legend(); }
public void ExecuteRecipe(Plot plt) { var rand = new Random(0); int pointCount = 1_000_000; double[] sine = DataGen.Sin(pointCount, 3); double[] noise = DataGen.RandomNormal(rand, pointCount, 0, 0.5); double[] ys = sine.Zip(noise, (s, n) => s + n).ToArray(); double[] xs = Enumerable.Range(0, pointCount) .Select(x => (double)x) .Select(x => x > 500_000 ? x + 1_000_000 : x) .Select(x => x > 200_000 ? x + 100_000 : x) .ToArray(); plt.AddSignalXY(xs, ys); }
public void Render(Plot plt) { Random rand = new Random(0); double[] values = DataGen.RandomNormal(rand, pointCount: 1000, mean: 50, stdDev: 20); var hist = new ScottPlot.Statistics.Histogram(values, min: 0, max: 100); double barWidth = hist.binSize * 1.2; // slightly over-side to reduce anti-alias rendering artifacts plt.PlotBar(hist.bins, hist.countsFrac, barWidth: barWidth, outlineWidth: 0); plt.PlotScatter(hist.bins, hist.countsFracCurve, markerSize: 0, lineWidth: 2, color: Color.Black); plt.Title("Normal Random Data"); plt.YLabel("Frequency (fraction)"); plt.XLabel("Value (units)"); plt.Axis(null, null, 0, null); plt.Grid(lineStyle: LineStyle.Dot); }
public void Render(Plot plt) { // generate random monthly data Random rand = new Random(0); double[] monthProfits = DataGen.RandomNormal(rand, 12, 5, 10); double[] monthNumbers = DataGen.Consecutive(12); string[] monthNames = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; plt.PlotWaterfall(monthNumbers, monthProfits, fillColor: Color.Green, negativeColor: Color.Red); plt.XTicks(monthNames); plt.YLabel("Valuation (million USD)"); plt.Title("Company Value in 2020"); }
public void ExecuteRecipe(Plot plt) { // create sample data to represent test scores Random rand = new Random(0); double[] scoresA = DataGen.RandomNormal(rand, 35, 72, 7); double[] scoresB = DataGen.RandomNormal(rand, 42, 57, 10); double[] scoresC = DataGen.RandomNormal(rand, 23, 79, 5); // To create a population series we need to start with an array of populations. // In this example each population series just has one population in it. var popsA = new Statistics.Population[] { new Statistics.Population(scoresA) }; var popsB = new Statistics.Population[] { new Statistics.Population(scoresB) }; var popsC = new Statistics.Population[] { new Statistics.Population(scoresC) }; // create a PopulationSeries for each set of scores, naming it in the process var seriesA = new Statistics.PopulationSeries(popsA, "Class A"); var seriesB = new Statistics.PopulationSeries(popsB, "Class B"); var seriesC = new Statistics.PopulationSeries(popsC, "Class C"); var seriesArray = new Statistics.PopulationSeries[] { seriesA, seriesB, seriesC }; // create a MultiSeries object by passing in the array of series objects and plot it var multiSeries = new Statistics.PopulationMultiSeries(seriesArray); var popPlot = plt.AddPopulations(multiSeries); // now customize its public fields to extensively customize its display options popPlot.DistributionCurve = true; popPlot.DistributionCurveLineStyle = LineStyle.Dash; popPlot.ScatterOutlineColor = System.Drawing.Color.Transparent; popPlot.DataFormat = ScottPlot.Plottable.PopulationPlot.DisplayItems.ScatterAndBox; popPlot.DataBoxStyle = ScottPlot.Plottable.PopulationPlot.BoxStyle.BarMeanStDev; // colors are managed at the population series level: foreach (var popSeries in popPlot.MultiSeries.multiSeries) { popSeries.color = Tools.GetRandomColor(rand); } // improve the style of the plot plt.Legend(location: Alignment.LowerLeft); plt.XAxis.Ticks(false); plt.XAxis.Grid(false); plt.YAxis.MajorGrid(lineStyle: LineStyle.Dot); plt.SetAxisLimits(yMin: 0); }
public Layout() { AvaloniaXamlLoader.Load(this); #if DEBUG this.AttachDevTools(); #endif mainPlot = this.Find <AvaPlot>("mainPlot"); rightPlot = this.Find <AvaPlot>("rightPlot"); lowerPlot = this.Find <AvaPlot>("lowerPlot"); // generate sample data Random rand = new Random(0); int[] xs = DataGen.RandomNormal(rand, 3000, 20, 10).Select(x => (int)x).ToArray(); int[] ys = DataGen.RandomNormal(rand, 3000, 20, 10).Select(y => (int)y).ToArray(); double[,] intensities = Tools.XYToIntensities(mode: IntensityMode.Gaussian, xs: xs, ys: ys, width: 100, height: 70, sampleWidth: 4); // main plot var hmc = mainPlot.Plot.AddHeatmap(intensities, lockScales: false); var cb = mainPlot.Plot.AddColorbar(hmc); mainPlot.Plot.Margins(0, 0); mainPlot.Plot.Title("Control Rod\nTemperature"); mainPlot.Plot.XLabel("Horizontal Position"); mainPlot.Plot.YLabel("Vertical Position"); mainPlot.Refresh(); // right plot double[] rowSums = SumHorizontally(intensities).Reverse().ToArray(); var rightBars = rightPlot.Plot.AddBar(rowSums); rightBars.Orientation = Orientation.Horizontal; rightBars.PositionOffset = .5; rightPlot.Plot.Margins(0, 0); rightPlot.Refresh(); // lower plot double[] colSums = SumVertically(intensities); var lowerBars = lowerPlot.Plot.AddBar(colSums); lowerBars.PositionOffset = .5; lowerPlot.Plot.Margins(0, 0); lowerPlot.Refresh(); UpdateChildPlots(); mainPlot.AxesChanged += MainPlot_AxesChanged; }
public void ExecuteRecipe(Plot plt) { int pointCount = 20; Random rand = new Random(0); double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.RandomWalk(rand, pointCount); double[] xErr = DataGen.RandomNormal(rand, pointCount, .2); double[] yErr = DataGen.RandomNormal(rand, pointCount); var sp = plt.AddScatter(xs, ys); sp.XError = xErr; sp.YError = yErr; sp.ErrorCapSize = 3; sp.ErrorLineWidth = 1; sp.LineStyle = LineStyle.Dot; }
public void Render(Plot plt) { // generate random data to plot Random rand = new Random(0); int pointCount = 10; double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.RandomNormal(rand, pointCount, 20, 5); // let's round the values to simplify display ys = Tools.Round(ys, 1); // add both bar plot plt.PlotBar(xs, ys, showValues: true); // customize the plot to make it look nicer plt.Grid(enableVertical: false, lineStyle: LineStyle.Dot); plt.Legend(); }
public void Render(Plot plt) { // create some sample data to represent test scores Random rand = new Random(0); double[] scores = DataGen.RandomNormal(rand, 35, 85, 5); // create a Population object and plot it var pop = new ScottPlot.Statistics.Population(scores); plt.PlotPopulations(pop, "scores"); // improve the style of the plot plt.Title($"Test Scores (mean: {pop.mean:0.00} +/- {pop.stDev:0.00}, n={pop.n})"); plt.YLabel("Score"); plt.Ticks(displayTicksX: false); plt.Legend(); plt.Grid(lineStyle: LineStyle.Dot, enableVertical: false); }