public void ExecuteRecipe(Plot plt) { // create sample data Random rand = new Random(3); double[] xs = DataGen.Consecutive(201); double[] ys = DataGen.RandomWalk(rand, xs.Length); // add filled polygons plt.AddFillAboveAndBelow(xs, ys); // tighten the axis limits so we don't see lines on the edges plt.SetAxisLimits(xMin: 0, xMax: 200); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.Style(figureBackgroundColor: Color.LightBlue); plt.Style(dataBackgroundColor: Color.LightYellow); }
public void Render(Plot plt) { plt.Validate(everyDataPoint: true); // plot some valid data Random rand = new Random(0); double[] ys = DataGen.RandomWalk(rand, 1000); double[] xs = DataGen.Consecutive(ys.Length); plt.PlotSignalXY(xs, ys); // modify X values so they are not all ascending xs[245] = xs[244] - 9; }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.PlotHLine(y: .85, draggable: true, dragLimitLower: -1, dragLimitUpper: +1); plt.PlotVLine(x: 23, draggable: true, dragLimitLower: 0, dragLimitUpper: 50); }
public void ExecuteRecipe(Plot plt) { double[] time = DataGen.Consecutive(51); double[] voltage = DataGen.Sin(51); plt.AddScatter(time, voltage); // Axes can be customized plt.XAxis.Label("Time (milliseconds)"); plt.YAxis.Label("Voltage (mV)"); plt.XAxis2.Label("Important Experiment"); // Set axis limits to control the view plt.SetAxisLimits(-20, 80, -2, 2); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); double[] cos2 = DataGen.Cos(pointCount, mult: -1); plt.PlotScatter(x, sin, color: Color.Magenta, label: "sin", lineWidth: 0, markerSize: 10); plt.PlotScatter(x, cos, color: Color.Green, label: "cos", lineWidth: 5, markerSize: 0); plt.PlotScatter(x, cos2, color: Color.Blue, label: "-cos", lineWidth: 3, markerSize: 0, lineStyle: LineStyle.DashDot); plt.Legend(fixedLineWidth: false); }
public Form1() { InitializeComponent(); double[] xs = DataGen.Consecutive(51); double[] ys = DataGen.Sin(51); ys = DataGen.InsertNanRanges(ys, new Random(0)); Scatter = formsPlot1.Plot.AddScatter(xs, ys); Scatter.OnNaN = ScottPlot.Plottable.ScatterPlot.NanBehavior.Gap; Marker = formsPlot1.Plot.AddMarker(0, 0, MarkerShape.openCircle, 20, Color.Red); formsPlot1.MouseMove += FormsPlot1_MouseMove; formsPlot1.Refresh(); }
public void ExecuteRecipe(Plot plt) { // create random data and display it with a scatter plot double[] xs = DataGen.Consecutive(50); double[] ys = DataGen.Random(new Random(0), 50); plt.AddScatter(xs, ys, label: "data"); // place the marker at the first data point var marker = plt.AddMarkerDraggable(xs[0], ys[0], MarkerShape.filledDiamond, 15, Color.Magenta); // constrain snapping to the array of data points marker.DragSnap = new ScottPlot.SnapLogic.Nearest2D(xs, ys); plt.Legend(); }
public void ExecuteRecipe(Plot plt) { plt.Palette = ScottPlot.Drawing.Palette.PolarNight; for (int i = 0; i < plt.Palette.Count(); i++) { double[] xs = DataGen.Consecutive(100); double[] ys = DataGen.Sin(100, phase: -i * .5 / plt.Palette.Count()); plt.AddScatterLines(xs, ys, lineWidth: 3); } plt.Title($"{plt.Palette}"); plt.AxisAutoX(0); plt.Style(ScottPlot.Style.Blue2); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.Ticks(rulerModeX: true, displayTicksY: false); plt.Frame(left: false, right: false, top: false); plt.TightenLayout(padding: 0, render: true); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.PlotVSpan(y1: .15, y2: .85, label: "VSpan"); plt.PlotHSpan(x1: 10, x2: 25, label: "HSpan"); plt.Legend(); }
private void LinkedPlots_Load(object sender, EventArgs e) { Random rand = new Random(0); int pointCount = 5000; double[] dataXs = DataGen.Consecutive(pointCount); double[] dataSin = DataGen.NoisySin(rand, pointCount); double[] dataCos = DataGen.NoisySin(rand, pointCount); formsPlot1.plt.PlotScatter(dataXs, dataSin); formsPlot1.Render(); formsPlot2.plt.PlotScatter(dataXs, dataCos); formsPlot2.Render(); }
protected void PlotResults <TNode>(string name, List <BenchmarkScenarioResult> results) { var plt = new Plot(600, 400); var xValues = DataGen.Consecutive(results[0].BenchmarkResults.Count); foreach (var result in results) { var times = result.BenchmarkResults.Select(x => x.Runs.Average(y => y.Time / 1000d)).ToList().OrderBy(x => x); plt.PlotScatter(xValues, times.ToArray(), label: result.Name); } plt.Legend(fontSize: 10, location: legendLocation.upperLeft); plt.Title(name); plt.SaveFig(Path.Combine(DirectoryFullPath, $"{name}.png")); }
private void ToggleVisibility_Load(object sender, EventArgs e) { int pointCount = 51; double[] dataXs = DataGen.Consecutive(pointCount); double[] dataSin = DataGen.Sin(pointCount); double[] dataCos = DataGen.Cos(pointCount); sinPlot = formsPlot1.plt.PlotScatter(dataXs, dataSin); cosPlot = formsPlot1.plt.PlotScatter(dataXs, dataCos); vline1 = formsPlot1.plt.PlotVLine(0); vline2 = formsPlot1.plt.PlotVLine(50); formsPlot1.Render(); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.Title("Plot Title"); plt.XLabel("Horizontal Axis"); plt.YLabel("Vertical Axis"); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 500; double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.Random(rand, pointCount); // A septile is a 7-quantile double secondSeptile = Statistics.Common.Quantile(ys, 2, 7); plt.Title("Second Septile"); plt.AddScatter(xs, ys, lineWidth: 0, markerShape: MarkerShape.openCircle); plt.AddHorizontalLine(secondSeptile, width: 3, style: LineStyle.Dash); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); plt.PlotVSpan(y1: .15, y2: .85, label: "VSpan", draggable: true, dragLimitLower: -1, dragLimitUpper: 1); plt.PlotHSpan(x1: 10, x2: 25, label: "HSpan", draggable: true, dragLimitLower: 0, dragLimitUpper: 50); plt.Legend(); }
public void Render(Plot plt) { int pointCount = 51; double[] x = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(x, sin); plt.PlotScatter(x, cos); Bitmap image = DataGen.SampleImage(); plt.PlotBitmap(image, 0, 0); }
public void ExecuteRecipe(Plot plt) { Random rand = new Random(0); int pointCount = 500; double[] xs = DataGen.Consecutive(pointCount); double[] ys = DataGen.Random(rand, pointCount); int n = 200; double nthValue = Statistics.Common.NthOrderStatistic(ys, n); plt.Title($"{n}th Smallest Value (of {pointCount})"); plt.AddScatter(xs, ys, lineWidth: 0, markerShape: MarkerShape.openCircle); plt.AddHorizontalLine(nthValue, width: 3, style: LineStyle.Dash); }
public void Test_Legend_LooksGoodInEveryPosition() { var mplt = new MultiPlot(1000, 800, 3, 3); legendLocation[] locs = Enum.GetValues(typeof(legendLocation)).Cast <legendLocation>().ToArray(); for (int i = 0; i < locs.Length; i++) { var plt = mplt.subplots[i]; plt.PlotScatter(DataGen.Consecutive(20), DataGen.Sin(20), markerShape: MarkerShape.filledSquare, label: "sin"); plt.PlotScatter(DataGen.Consecutive(20), DataGen.Cos(20), markerShape: MarkerShape.openDiamond, label: "cos"); plt.Legend(location: locs[i]); plt.Title(locs[i].ToString()); } TestTools.SaveFig(mplt); }
public void ExecuteRecipe(Plot plt) { // generate sample stock prices OHLC[] ohlcs = DataGen.RandomStockPrices(null, 100); double[] xs = DataGen.Consecutive(ohlcs.Length); // calculate the bands and the time range they cover double[] xs2 = xs.Skip(20).ToArray(); (var sma, var bolL, var bolU) = Statistics.Finance.Bollinger(ohlcs, 20); // plot technical indicators as scatter plots above the financial chart plt.AddCandlesticks(ohlcs); plt.AddScatter(xs2, sma, markerSize: 0, color: Color.Blue); plt.AddScatter(xs2, bolL, markerSize: 0, color: Color.Blue, lineStyle: LineStyle.Dash); plt.AddScatter(xs2, bolU, markerSize: 0, color: Color.Blue, lineStyle: LineStyle.Dash); }
public void ExecuteRecipe(Plot plt) { // Create some linear but noisy data double[] ys = DataGen.NoisyLinear(null, pointCount: 100, noise: 30); double[] xs = DataGen.Consecutive(ys.Length); double x1 = xs[0]; double x2 = xs[xs.Length - 1]; // use the linear regression fitter to fit these data var model = new ScottPlot.Statistics.LinearRegressionLine(xs, ys); // plot the original data and add the regression line plt.Title($"Y = {model.slope:0.0000}x + {model.offset:0.0}\nR² = {model.rSquared:0.0000}"); plt.AddScatter(xs, ys, lineWidth: 0); plt.AddLine(model.slope, model.offset, (x1, x2), lineWidth: 2); }
// Disabled because this test fails on Linux and MacOS due to a System.Drawing limitation //[Test] public void Test_Legend_Bold() { var plt = new ScottPlot.Plot(600, 400); plt.PlotScatter(DataGen.Consecutive(51), DataGen.Sin(51), label: "sin"); plt.PlotScatter(DataGen.Consecutive(51), DataGen.Cos(51), label: "cos"); plt.Legend(); var meanRegular = TestTools.MeanPixel(plt.GetBitmap()); plt.Legend(bold: true); var meanBold = TestTools.MeanPixel(plt.GetBitmap()); // bold text will darken the mean pixel intensity Assert.Less(meanBold.R, meanRegular.R); }
public LinkedPlots() { InitializeComponent(); int pointCount = 51; double[] dataXs = DataGen.Consecutive(pointCount); double[] dataSin = DataGen.Sin(pointCount); double[] dataCos = DataGen.Cos(pointCount); wpfPlot1.plt.PlotScatter(dataXs, dataSin); wpfPlot1.Render(); wpfPlot2.plt.PlotScatter(dataXs, dataCos); wpfPlot2.Render(); }
public void ExecuteRecipe(Plot plt) { double[] xs = DataGen.Consecutive(51); double[] sin = DataGen.Sin(51); // instantiate a plottable var splt = new ScottPlot.Plottable.ScatterPlot(xs, sin); // customize its style or change its data as desired splt.Color = Color.Navy; splt.MarkerSize = 10; splt.MarkerShape = MarkerShape.filledDiamond; // add it to the plot plt.Add(splt); }
public void ExecuteRecipe(Plot plt) { // sample data double[] xs = DataGen.Consecutive(51); double[] sin = DataGen.Sin(51); double[] cos = DataGen.Cos(51); // plot the data plt.AddScatter(xs, sin); plt.AddScatter(xs, cos); // customize the axis labels plt.Title("ScottPlot Quickstart"); plt.XLabel("Horizontal Axis"); plt.YLabel("Vertical Axis"); }
private void Form1_Load(object sender, EventArgs e) { vline = formsPlot1.plt.PlotVLine(1); hline = formsPlot1.plt.PlotHLine(1); formsPlot1.plt.PlotHSpan(10, 20, draggable: true); formsPlot1.plt.PlotVSpan(5, 10, draggable: true); Random rand = new Random(0); double[] xs = DataGen.Consecutive(100); double[] ys = DataGen.RandomWalk(rand, 100); sph = formsPlot1.plt.PlotScatterHighlight(xs, ys); formsPlot1.Render(); }
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[] xErrPos = DataGen.RandomNormal(rand, pointCount).Select(e => Math.Abs(e)).ToArray(); double[] xErrNeg = DataGen.RandomNormal(rand, pointCount).Select(e => Math.Abs(e)).ToArray(); double[] yErrPos = DataGen.RandomNormal(rand, pointCount).Select(e => Math.Abs(e)).ToArray(); double[] yErrNeg = 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, xErrPos, xErrNeg, yErrPos, yErrNeg, System.Drawing.Color.Blue); }
public void Render(Plot plt) { int pointCount = 51; double[] xs = DataGen.Consecutive(pointCount); double[] sin = DataGen.Sin(pointCount); double[] cos = DataGen.Cos(pointCount); plt.PlotScatter(xs, sin, label: "sin"); plt.PlotScatter(xs, cos, label: "cos"); plt.Legend(); plt.Title("Scatter Plot Quickstart"); plt.YLabel("Vertical Units"); plt.XLabel("Horizontal Units"); }
public void UpdatePlot(double[] data, bool isTotal) { if (maze_plot == null || total_plot == null || (data != null && data.Length != columns_length)) { Console.WriteLine("Plot Error!"); return; } double[] xs = DataGen.Consecutive(columns_length); FormsPlot plot = (isTotal) ? total_plot : maze_plot; plot.plt.Clear(); plot.plt.PlotBar(xs, data, fillColor: background); plot.Render(); }