Ejemplo n.º 1
0
        public void ExecuteRecipe(Plot plt)
        {
            double SupplyFunction(double q) => 5 * q + 1;
            double DemandFunction(double q) => - 3 * q + 17;

            const double priceFloor = 12.5;

            double[] xs     = DataGen.Consecutive(5);
            double[] supply = xs.Select(SupplyFunction).ToArray();
            double[] demand = xs.Select(DemandFunction).ToArray();

            plt.AddScatter(xs, supply, markerShape: MarkerShape.none, label: "Supply");
            plt.AddScatter(xs, demand, markerShape: MarkerShape.none, label: "Demand");
            plt.AddHorizontalLine(priceFloor, label: "Price Floor");

            double[] maxProducerSurplusBounds = new double[] { 0, 1.5 };
            var      maxProducerSurplus       = plt.AddFill(maxProducerSurplusBounds, maxProducerSurplusBounds.Select(SupplyFunction).ToArray(), maxProducerSurplusBounds, Enumerable.Repeat(priceFloor, 2).ToArray());

            maxProducerSurplus.LineWidth  = 0;
            maxProducerSurplus.FillColor  = Color.LawnGreen;
            maxProducerSurplus.HatchColor = Color.Transparent;
            maxProducerSurplus.HatchStyle = Drawing.HatchStyle.StripedWideDownwardDiagonal;
            maxProducerSurplus.Label      = "Maximum Possible Producer Surplus";

            double[] minProducerSurplusBounds = new double[] { 1.2, 2.3 };
            var      minProducerSurplus       = plt.AddFill(minProducerSurplusBounds, minProducerSurplusBounds.Select(SupplyFunction).ToArray(), minProducerSurplusBounds, Enumerable.Repeat(priceFloor, 2).ToArray());

            minProducerSurplus.LineWidth  = 0;
            minProducerSurplus.FillColor  = Color.Transparent;
            minProducerSurplus.HatchColor = Color.Red;
            minProducerSurplus.HatchStyle = Drawing.HatchStyle.StripedWideDownwardDiagonal;
            minProducerSurplus.Label      = "Minimum Possible Producer Surplus";

            plt.Legend();
        }
Ejemplo n.º 2
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs = DataGen.Range(0, 5, .1);
            plt.AddScatter(xs, DataGen.Sin(xs));
            plt.AddScatter(xs, DataGen.Cos(xs));

            // default placement is upper left
            plt.AddAnnotation("Top Left", 10, 10);

            // negative coordinates can be used to place text along different edges
            plt.AddAnnotation("Lower Left", 10, -10);
            plt.AddAnnotation("Top Right", -10, 10);
            plt.AddAnnotation("Lower Right", -10, -10);

            // Additional customizations are available
            var fancy = plt.AddAnnotation("Fancy Annotation", 10, 40);

            fancy.FontSize        = 24;
            fancy.FontName        = "Impact";
            fancy.FontColor       = Color.Red;
            fancy.Shadow          = false;
            fancy.BackgroundColor = Color.FromArgb(25, Color.Blue);
            fancy.BorderWidth     = 2;
            fancy.BorderColor     = Color.Magenta;
        }
Ejemplo n.º 3
0
        public void ExecuteRecipe(Plot plt)
        {
            var plot1 = plt.AddScatter(new double[] { 2.5 }, new double[] { 5 }, label: "John Doe et al.");

            plot1.XError = new double[] { 0.2 };

            var plot2 = plt.AddScatter(new double[] { 2.7 }, new double[] { 4 }, label: "Jane Doe et al.");

            plot2.XError = new double[] { 0.3 };

            var plot3 = plt.AddScatter(new double[] { 2.3 }, new double[] { 3 }, label: "Jim Doe et al.");

            plot3.XError = new double[] { 0.6 };

            var plot4 = plt.AddScatter(new double[] { 2.8 }, new double[] { 2 }, label: "Joel Doe et al.");

            plot4.XError = new double[] { 0.3 };

            var plot5 = plt.AddScatter(new double[] { 2.5 }, new double[] { 1 }, label: "Jacqueline Doe et al.");

            plot5.XError = new double[] { 0.2 };

            plt.AddVerticalLine(2.6, style: LineStyle.Dash);

            plt.SetAxisLimits(0, 5, 0, 6);
            plt.Legend();
        }
Ejemplo n.º 4
0
        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)");
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var customCulture = new System.Globalization.CultureInfo("en-NZ");

            customCulture.DateTimeFormat.ShortDatePattern        = "yyyy-MM-dd";
            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            int width  = 800;
            int height = 600;
            var plot   = new Plot(width, height);

            DateTime[] myDates   = new DateTime[60];
            var        startdate = DateTime.Now;

            for (int i = 0; i < myDates.Length; i++)
            {
                myDates[i] = startdate.AddMinutes(i);
            }

            double[] dataX = myDates.Select(x => x.ToOADate()).ToArray();
            //plot.PlotScatter(dataX, dataY);

            plot.XAxis.DateTimeFormat(true);

            plot.YAxis.Label("°C");
            plot.YAxis.Color(Color.Red);

            plot.SetAxisLimitsY(0, 50);


            //double[] dataX = DataGen.Consecutive(60);
            double[] dataY = DataGen.Sin(60, 2, 25, 2);
            //plot.PlotScatter(dataX, dataY);

            var scatter = plot.AddScatter(dataX, dataY);

            scatter.LineWidth = 2;
            scatter.Color     = Color.Red;

            var baroScatter = plot.AddScatter(dataX, DataGen.Sin(60, 6, 1013, 4));

            var baroLimits = baroScatter.GetAxisLimits();


            var yAxis3 = plot.AddAxis(ScottPlot.Renderable.Edge.Left, axisIndex: 2);

            baroScatter.YAxisIndex = 2;
            yAxis3.Label("hPa");
            yAxis3.Color(baroScatter.Color);


            plot.SaveFig("out.png");
            var bitmap = plot.Render();
            var png    = ImageToPngByte(bitmap);


            Console.WriteLine($"PNG byte size is {png.Length}");
        }
Ejemplo n.º 6
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs  = DataGen.Consecutive(51);
            double[] sin = DataGen.Sin(51);
            double[] cos = DataGen.Cos(51);

            plt.AddScatter(xs, sin, color: Color.Red);
            plt.Clear();
            plt.AddScatter(xs, cos, color: Color.Blue);
        }
Ejemplo n.º 7
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs  = DataGen.Consecutive(51);
            double[] sin = DataGen.Sin(51);
            double[] cos = DataGen.Cos(51);

            plt.AddScatter(xs, sin, label: "sin");
            plt.AddScatter(xs, cos, label: "cos");
            plt.Legend();
        }
Ejemplo n.º 8
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs  = DataGen.Consecutive(51);
            double[] sin = DataGen.Sin(51);
            double[] cos = DataGen.Sin(51);

            var sinPlot = plt.AddScatter(xs, sin, color: Color.Red);
            var cosPlot = plt.AddScatter(xs, cos, color: Color.Blue);

            plt.Remove(sinPlot);
        }
Ejemplo n.º 9
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs      = DataGen.Consecutive(51);
            double[] sines   = DataGen.Sin(51);
            double[] cosines = DataGen.Cos(51);

            plt.AddScatter(xs, sines);
            plt.AddScatter(xs, cosines);
            plt.AddFill(xs, sines);
            plt.AddFill(xs, cosines);

            plt.Grid(onTop: true);
        }
Ejemplo n.º 10
0
        public void ExecuteRecipe(Plot plt)
        {
            int pointCount = 51;

            double[] x   = DataGen.Consecutive(pointCount);
            double[] sin = DataGen.Sin(pointCount);
            double[] cos = DataGen.Cos(pointCount);

            plt.AddScatter(x, sin);
            plt.AddScatter(x, cos);

            plt.AddText("sample text", 10, .5, size: 16, color: Color.Blue);
        }
Ejemplo n.º 11
0
        public void ExecuteRecipe(Plot plt)
        {
            // create sample X/Y data
            int pointCount = 51;

            double[] x   = DataGen.Consecutive(pointCount);
            double[] sin = DataGen.Sin(pointCount);
            double[] cos = DataGen.Cos(pointCount);

            // add scatter plots
            plt.AddScatter(x, sin);
            plt.AddScatter(x, cos);
        }
Ejemplo n.º 12
0
        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();
        }
Ejemplo n.º 13
0
        public void ExecuteRecipe(Plot plt)
        {
            // generate some interesting log-distributed data
            int pointCount = 200;

            double[] dataXs = new double[pointCount];
            double[] dataYs = new double[pointCount];
            Random   rand   = new Random(0);

            for (int i = 0; i < pointCount; i++)
            {
                double x = 10.0 * i / pointCount;
                dataXs[i] = x;
                dataYs[i] = Math.Pow(2, x) + rand.NextDouble() * i;
            }

            // this tool can convert linear data to log data
            double[] dataYsLog = ScottPlot.Tools.Log10(dataYs);
            plt.AddScatter(dataXs, dataYsLog, lineWidth: 0);

            // place minor ticks to simulate a log scale
            plt.YAxis.MinorLogScale(true);

            // make minor grid lines visible for added effect
            plt.YAxis.MinorGrid(enable: true, color: Color.FromArgb(10, Color.Black));

            // decorate the plot
            plt.Title("Data (Log Scale)");
            plt.YLabel("Vertical Units (10^x)");
            plt.XLabel("Horizontal Units");
        }
Ejemplo n.º 14
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.Palette = ScottPlot.Palette.ColorblindFriendly;

            // generate random data
            System.Random rand = new(12345);
            var           xs   = ScottPlot.DataGen.RandomWalk(rand, 20);
            var           ys   = ScottPlot.DataGen.RandomWalk(rand, 20);

            plt.AddScatter(xs, ys, lineStyle: ScottPlot.LineStyle.Dash, markerSize: 10, label: "original");

            // interpolate the same data in different ways
            (double[] bzX, double[] bzY) = ScottPlot.Statistics.Interpolation.Bezier.InterpolateXY(xs, ys, .005);
            (double[] crX, double[] crY) = ScottPlot.Statistics.Interpolation.CatmullRom.InterpolateXY(xs, ys, 15);
            (double[] chX, double[] chY) = ScottPlot.Statistics.Interpolation.Chaikin.InterpolateXY(xs, ys, 4);
            (double[] cbX, double[] cbY) = ScottPlot.Statistics.Interpolation.Cubic.InterpolateXY(xs, ys, 200);

            // display the different curves as line plots
            plt.AddScatterLines(bzX, bzY, lineWidth: 2, label: $"Bezier");
            plt.AddScatterLines(crX, crY, lineWidth: 2, label: $"Catmull-Rom");
            plt.AddScatterLines(chX, chY, lineWidth: 2, label: $"Chaikin");
            plt.AddScatterLines(cbX, cbY, lineWidth: 2, label: $"Cubic");

            // style the plot
            plt.Legend();
            plt.Frameless();
            plt.Grid(false);
            plt.XAxis2.Label("Spline Interpolation", size: 28, bold: true);
        }
Ejemplo n.º 15
0
        public void ExecuteRecipe(Plot plt)
        {
            // create a small number of X/Y data points and display them
            Random rand = new(1234);

            double[] xs = DataGen.RandomWalk(rand, 20);
            double[] ys = DataGen.RandomWalk(rand, 20);

            // interpolate the data to create a smooth curve
            (double[] smoothXs, double[] smoothYs) = ScottPlot.Statistics.Interpolation.Cubic.InterpolateXY(xs, ys, 200);

            // plot the original vs interpolated lines
            plt.AddScatter(xs, ys, Color.Green, markerSize: 10, lineWidth: 1, label: "Original");
            plt.AddScatter(smoothXs, smoothYs, Color.Magenta, label: "Interpolated");
            plt.Legend();
        }
Ejemplo n.º 16
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] ys    = ScottPlot.DataGen.Range(100, 10_000, 100, true);
            double[] xs    = ScottPlot.DataGen.Consecutive(ys.Length);
            double[] logYs = ys.Select(y => Math.Log10(y)).ToArray();

            var scatter = plt.AddScatter(xs, logYs);
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.Title("Crosshair with DateTime Axis");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");

            // plot DateTime data
            int    pointCount = 100;
            Random rand       = new Random(0);

            double[]   values = ScottPlot.DataGen.RandomWalk(rand, pointCount);
            DateTime[] dates  = Enumerable.Range(0, pointCount)
                                .Select(x => new DateTime(2016, 06, 27).AddDays(x))
                                .ToArray();
            double[] xs = dates.Select(x => x.ToOADate()).ToArray();
            plt.AddScatter(xs, values);

            // add a crosshair
            var ch = plt.AddCrosshair(xs[50], values[50]);

            // indicaite horizontal axis is DateTime and give a proper DateTime format string
            // https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
            ch.VerticalLine.PositionFormatter = pos => DateTime.FromOADate(pos).ToString("d");

            // use a numeric vertical axis but customize the format string
            // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
            ch.VerticalLine.PositionFormatter = pos => pos.ToString("F4");
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        public void ExecuteRecipe(Plot plt)
        {
            // create data with polar coordinates
            int    count = 400;
            double step  = 0.01;

            double[] rs     = new double[count];
            double[] thetas = new double[count];

            for (int i = 0; i < rs.Length; i++)
            {
                rs[i]     = 1 + i * step;
                thetas[i] = i * 2 * Math.PI * step;
            }

            // convert polar data to Cartesian data
            (double[] xs, double[] ys) = ScottPlot.Tools.ConvertPolarCoordinates(rs, thetas);

            // plot the Cartesian data
            plt.AddScatter(xs, ys);

            // decorate the plot
            plt.Title("Scatter Plot of Polar Data");
            plt.AxisScaleLock(true);
        }
Ejemplo n.º 21
0
        public void ExecuteRecipe(Plot plt)
        {
            // create a series of dates
            int pointCount = 20;

            double[] dates    = new double[pointCount];
            var      firstDay = new DateTime(2020, 1, 22);

            for (int i = 0; i < pointCount; i++)
            {
                dates[i] = firstDay.AddDays(i).ToOADate();
            }

            // simulate data for each date
            double[] values = new double[pointCount];
            Random   rand   = new Random(0);

            for (int i = 1; i < pointCount; i++)
            {
                values[i] = values[i - 1] + rand.NextDouble();
            }

            plt.AddScatter(dates, values);
            plt.XAxis.DateTimeFormat(true);

            // define tick spacing as 1 day (every day will be shown)
            plt.XAxis.ManualTickSpacing(1, ScottPlot.Ticks.DateTimeUnit.Day);
            plt.XAxis.TickLabelStyle(rotation: 45);

            // add some extra space for rotated ticks
            plt.XAxis.SetSizeLimit(min: 50);
        }
Ejemplo n.º 22
0
        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");
        }
Ejemplo n.º 23
0
        public void ExecuteRecipe(Plot plt)
        {
            int pointCount = 51;

            double[] x   = DataGen.Consecutive(pointCount);
            double[] sin = DataGen.Sin(pointCount);
            double[] cos = DataGen.Cos(pointCount);

            // add scatter plots and customize markers
            var sp1 = plt.AddScatter(x, sin, markerSize: 15);

            sp1.MarkerShape = MarkerShape.openCircle;

            var sp2 = plt.AddScatter(x, cos, markerSize: 7);

            sp2.MarkerShape = MarkerShape.filledSquare;
        }
Ejemplo n.º 24
0
        public void ExecuteRecipe(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.AddScatter(x, sin, color: Color.Magenta, lineWidth: 0, markerSize: 10);
            plt.AddScatter(x, cos, color: Color.Green, lineWidth: 5, markerSize: 0);
            plt.AddScatter(x, cos2, color: Color.Blue, lineWidth: 3, markerSize: 0, lineStyle: LineStyle.DashDot);

            var legend = plt.Legend();

            legend.FixedLineWidth = false;
        }
Ejemplo n.º 25
0
        public void ExecuteRecipe(Plot plt)
        {
            // create sample data
            double[] xs  = DataGen.Range(0, 10, .1, true);
            double[] ys1 = DataGen.Sin(xs);
            double[] ys2 = DataGen.Cos(xs);

            // add a polygon to fill the region between the two curves
            plt.AddFill(xs, ys1, xs, ys2);

            // add two scatter plots the traditional way
            plt.AddScatter(xs, ys1, color: Color.Black);
            plt.AddScatter(xs, ys2, color: Color.Black);

            // tighten the axis limits so we don't see lines on the edges
            plt.SetAxisLimits(xMin: 0, xMax: 10);
        }
Ejemplo n.º 26
0
        public void ExecuteRecipe(Plot plt)
        {
            // generate sample stock prices
            OHLC[]   ohlcs = DataGen.RandomStockPrices(null, 75);
            double[] xs    = DataGen.Consecutive(ohlcs.Length);

            // calculate SMAs of different durations using helper methods
            double[] sma8xs  = xs.Skip(8).ToArray();
            double[] sma8ys  = Statistics.Finance.SMA(ohlcs, 8);
            double[] sma20xs = xs.Skip(20).ToArray();
            double[] sma20ys = Statistics.Finance.SMA(ohlcs, 20);

            // plot technical indicators as scatter plots above the financial chart
            plt.AddCandlesticks(ohlcs);
            plt.AddScatter(sma8xs, sma8ys, markerSize: 0, color: Color.Blue, lineWidth: 2);
            plt.AddScatter(sma20xs, sma20ys, markerSize: 0, color: Color.Navy, lineWidth: 2);
        }
Ejemplo n.º 27
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] largeXs = DataGen.Consecutive(100, spacing: 1e6);
            double[] largeYs = DataGen.Random(null, 100, multiplier: 1e6);

            plt.AddScatter(largeXs, largeYs);
            plt.XAxis.TickLabelNotation(offset: true);
        }
Ejemplo n.º 28
0
        private static void GraphBuoyInfo(List <BuoyInfo> buoyInfo, string fileLocation)
        {
            TimeZoneInfo centralTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");

            double[] dataX = buoyInfo.Select(item => TimeZoneInfo.ConvertTimeFromUtc(item.GetDate(), centralTimeZone).ToOADate()).ToArray();

            double[] dataY_wind = buoyInfo.Select(item => Convert.ToDouble(MetersPerSecondToKnots(item.GetWindSpeed()))).ToArray();

            double[] dataY_gust = buoyInfo.Select(item => Convert.ToDouble(MetersPerSecondToKnots(item.GetGust()))).ToArray();

            Plot plot = new Plot(1000, 500);

            plot.AddScatter(dataX, dataY_wind);
            plot.AddScatter(dataX, dataY_gust);
            plot.XAxis.DateTimeFormat(true);
            plot.YAxis.Label("Knots");
            plot.SaveFig(fileLocation);
        }
Ejemplo n.º 29
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] xs     = DataGen.Consecutive(100_000, 1.0 / 20_000);
            double[] values = DataGen.RandomWalk(null, 100_000);

            plt.AddScatter(xs, values, Color.Red, markerSize: 0);

            plt.Benchmark(enable: true);
            plt.Title($"Scatter Plot: One Million Points");
        }
Ejemplo n.º 30
0
        public void ExecuteRecipe(Plot plt)
        {
            // create data that does NOT contain NaN
            double[] xs = ScottPlot.DataGen.Consecutive(51);
            double[] ys = ScottPlot.DataGen.Sin(51);

            // plot it the traditional way
            plt.AddScatter(xs, ys, Color.FromArgb(50, Color.Black));

            // create new data that contains NaN
            double[] ysWithNan = ScottPlot.DataGen.Sin(51);