예제 #1
0
        public void Test_SMA_Candlestick()
        {
            Random rand = new Random(0);

            double[] xs    = DataGen.Consecutive(150);
            OHLC[]   ohlcs = DataGen.RandomStockPrices(rand, xs.Length);
            double[] sma20 = ScottPlot.Statistics.Finance.SMA(ohlcs, 20);
            double[] sma50 = ScottPlot.Statistics.Finance.SMA(ohlcs, 50);

            // replace timestamps with a series of numbers starting at 0
            for (int i = 0; i < ohlcs.Length; i++)
            {
                ohlcs[i].time = i;
            }

            var plt = new ScottPlot.Plot(600, 400);

            plt.PlotCandlestick(ohlcs);
            plt.PlotScatter(xs, sma20, label: "20 day SMA",
                            color: Color.Blue, markerSize: 0, lineWidth: 2);
            plt.PlotScatter(xs, sma50, label: "50 day SMA",
                            color: Color.Maroon, markerSize: 0, lineWidth: 2);

            plt.Title("Simple Moving Average (SMA)");
            plt.YLabel("Price");
            plt.XLabel("Days");
            plt.Legend();
            plt.AxisAutoX(.03);
            TestTools.SaveFig(plt);
        }
예제 #2
0
        public void Test_Bollinger_Bands()
        {
            Random rand = new Random(0);

            double[] xs    = DataGen.Consecutive(150);
            OHLC[]   ohlcs = DataGen.RandomStockPrices(rand, xs.Length);
            (var sma, var bolL, var bolU) = ScottPlot.Statistics.Finance.Bollinger(ohlcs);

            // replace timestamps with a series of numbers starting at 0
            for (int i = 0; i < ohlcs.Length; i++)
            {
                ohlcs[i].time = i;
            }

            var plt = new ScottPlot.Plot(600, 400);

            plt.PlotCandlestick(ohlcs);
            plt.PlotFill(xs, bolL, xs, bolU, fillColor: Color.Blue, fillAlpha: .1);
            plt.PlotScatter(xs, bolL, color: Color.Navy, markerSize: 0);
            plt.PlotScatter(xs, bolU, color: Color.Navy, markerSize: 0);
            plt.PlotScatter(xs, sma, color: Color.Navy, markerSize: 0, lineStyle: LineStyle.Dash);

            plt.Title("Bollinger Bands");
            plt.YLabel("Price");
            plt.XLabel("Days");
            plt.Legend();
            plt.AxisAutoX(.03);
            TestTools.SaveFig(plt);
        }
예제 #3
0
        private void FillDemoPlots()
        {
            Random rand = new Random();

            if (true)
            {
                var plt = new ScottPlot.Plot(600, 400);

                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");

                var pv1 = new ScottPlot.WpfPlot();
                pv1.Height = 200;

                plt.Title("Scatter Plot Quickstart");
                plt.YLabel("Vertical Units");
                plt.XLabel("Horizontal Units");

                StackPanelCharts.Children.Add(pv1);
            }

            if (true)
            {
                var pv1 = new ScottPlot.WpfPlot();
                pv1.Height = 200;
                pv1.plt.PlotSignal(DataGen.RandomWalk(rand, 100));

                var      plt        = pv1.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");

                StackPanelCharts.Children.Add(pv1);
            }
        }
예제 #4
0
        public void Test_Legend_RequestBeforeRender()
        {
            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();

            System.Drawing.Bitmap bmpLegend = plt.GetLegendBitmap();
            Assert.Less(bmpLegend.Width, 600);
            Assert.Less(bmpLegend.Height, 400);
        }
예제 #5
0
        private void PlotDemoData(int pointCount = 101)
        {
            double pointSpacing = .01;

            double[] dataXs  = ScottPlot.DataGen.Consecutive(pointCount, pointSpacing);
            double[] dataSin = ScottPlot.DataGen.Sin(pointCount);
            double[] dataCos = ScottPlot.DataGen.Cos(pointCount);

            plt.PlotScatter(dataXs, dataSin);
            plt.PlotScatter(dataXs, dataCos);
            plt.AxisAuto(0);
            plt.Title("ScottPlot User Control");
            plt.YLabel("Sample Data");
            Render();
        }
예제 #6
0
파일: Clear.cs 프로젝트: riQQ/ScottPlot
        private ScottPlot.Plot GetDemoPlot()
        {
            Random rand = new Random(0);
            var    plt  = new ScottPlot.Plot();

            plt.PlotScatter(ScottPlot.DataGen.Random(rand, 100, 20), ScottPlot.DataGen.Random(rand, 100, 5, 3), label: "scatter1");
            plt.PlotSignal(ScottPlot.DataGen.RandomWalk(rand, 100), label: "signal1");
            plt.PlotScatter(ScottPlot.DataGen.Random(rand, 100), ScottPlot.DataGen.Random(rand, 100), label: "scatter2");
            plt.PlotSignal(ScottPlot.DataGen.RandomWalk(rand, 100), label: "signal2");
            plt.PlotVLine(43, lineWidth: 4, label: "vline");
            plt.PlotHLine(1.23, lineWidth: 4, label: "hline");
            plt.PlotText("ScottPlot", 50, 0.25, rotation: -45, fontSize: 36, label: "text");
            plt.Legend();
            return(plt);
        }
예제 #7
0
        public void Test_TickAlignment_SnapEdgePixel()
        {
            Random rand = new Random(0);

            double[] xs = DataGen.Range(0, 10, .1, true);
            double[] ys = DataGen.RandomWalk(rand, xs.Length, .5);

            var plt = new ScottPlot.Plot(320, 240);

            plt.PlotScatter(xs, ys, markerSize: 0);
            plt.PlotScatter(ys, xs, markerSize: 0);
            plt.AxisAuto(0, 0);

            TestTools.SaveFig(plt);
        }
예제 #8
0
        // 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);
        }
예제 #9
0
        public void Test_Legend_Style()
        {
            var plt1 = new ScottPlot.Plot(600, 400);

            plt1.PlotScatter(DataGen.Sin(10), DataGen.Sin(10), label: "sin", color: Color.Black, lineWidth: 1);
            plt1.Legend();
            var mean1 = TestTools.MeanPixel(plt1.GetBitmap());

            var plt2 = new ScottPlot.Plot(600, 400);

            plt2.PlotScatter(DataGen.Sin(10), DataGen.Sin(10), label: "sin", color: Color.Black, lineWidth: 2);
            plt2.Legend();
            var mean2 = TestTools.MeanPixel(plt2.GetBitmap());

            // thicker line means darker pixel intensity
            Assert.Less(mean2.R, mean1.R);

            var plt3 = new ScottPlot.Plot(600, 400);

            plt3.PlotScatter(DataGen.Sin(10), DataGen.Sin(10), label: "sin", color: Color.Gray, lineWidth: 2);
            plt3.Legend();
            var mean3 = TestTools.MeanPixel(plt3.GetBitmap());

            // lighter color means greater pixel intensity
            Assert.Greater(mean3.R, mean2.R);
        }
예제 #10
0
        public void Test_Population_CurveSideways()
        {
            Random rand = new Random(0);
            var    ages = new ScottPlot.Statistics.Population(rand, 44, 78, 2);

            double[] curveXs = DataGen.Range(ages.minus3stDev, ages.plus3stDev, .1);
            double[] curveYs = ages.GetDistribution(curveXs);

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotScatter(DataGen.Random(rand, ages.values.Length), ages.values,
                            markerSize: 10, markerShape: MarkerShape.openCircle, lineWidth: 0);
            plt.PlotScatter(curveYs, curveXs, markerSize: 0);
            plt.Grid(lineStyle: LineStyle.Dot);

            TestTools.SaveFig(plt);
        }
예제 #11
0
        public void Test_Legend_Render()
        {
            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");

            var mean1 = TestTools.MeanPixel(plt.GetBitmap());

            plt.Legend();
            var mean2 = TestTools.MeanPixel(plt.GetBitmap());

            // the legend should darken the mean pixel intensity
            Assert.AreEqual(mean2.A, mean1.A);
            Assert.Less(mean2.R, mean1.R);
            Assert.Less(mean2.G, mean1.G);
            Assert.Less(mean2.B, mean1.B);
        }
예제 #12
0
        //[Test]
        public void Test_Scatter_MinMaxRenderIndex()
        {
            var plt  = new ScottPlot.Plot(500, 300);
            var sctr = plt.PlotScatter(DataGen.Consecutive(51), DataGen.Sin(51));

            sctr.minRenderIndex = 10;
            sctr.maxRenderIndex = 30;
            TestTools.SaveFig(plt);
        }
예제 #13
0
        public void Test_Scatter_EmptyArrays()
        {
            double[] dataX = { };
            double[] dataY = { };

            var plt = new ScottPlot.Plot(400, 300);

            Assert.Throws <ArgumentException>(() => { plt.PlotScatter(dataX, dataY); });
        }
예제 #14
0
        public void Test_Layout()
        {
            int pointCount = 50;

            double[] dataXs  = DataGen.Consecutive(pointCount);
            double[] dataSin = DataGen.Sin(pointCount);
            double[] dataCos = DataGen.Cos(pointCount);

            var plt = new ScottPlot.Plot();

            plt.PlotScatter(dataXs, dataSin);
            plt.PlotScatter(dataXs, dataCos);

            plt.Title("Very Complicated Data");
            plt.XLabel("Experiment Duration");
            plt.YLabel("Productivity");

            TestTools.SaveFig(plt);
        }
예제 #15
0
        public void Test_Axis_ExtremelySmallNumbers()
        {
            var plt = new ScottPlot.Plot(400, 300);

            plt.Title("Extremely Small (e-20)");
            double[] xs = { 1e-20, 2e-20, 3e-20, 4e-20 };
            double[] ys = { 1e-20, 4e-20, 3e-20, 6e-20 };
            plt.PlotScatter(xs, ys);
            TestTools.SaveFig(plt);
        }
예제 #16
0
        public void Test_Axis_ModeratelySmallNumbers()
        {
            var plt = new ScottPlot.Plot(400, 300);

            plt.Title("Moderately Small (e-8)");
            double[] xs = { 1e-8, 2e-8, 3e-8, 4e-8 };
            double[] ys = { 1e-8, 4e-8, 3e-8, 6e-8 };
            plt.PlotScatter(xs, ys);
            TestTools.SaveFig(plt);
        }
예제 #17
0
        public void Test_Scatter_HasNanY()
        {
            double[] dataX = { 1, 2, 3, 4, 5 };
            double[] dataY = { 1, 3, double.NaN, 16, 25 };

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotScatter(dataX, dataY);

            TestTools.SaveFig(plt);
        }
예제 #18
0
        public void Test_Scatter_HasInfX()
        {
            double[] dataX = { 1, 2, double.PositiveInfinity, 4, 5 };
            double[] dataY = { 1, 3, 9, 16, 25 };

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotScatter(dataX, dataY);

            TestTools.SaveFig(plt);
        }
예제 #19
0
        public void Test_Scatter_AllZeros()
        {
            double[] dataX = { 0, 0, 0, 0, 0 };
            double[] dataY = { 0, 0, 0, 0, 0 };

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotScatter(dataX, dataY);

            TestTools.SaveFig(plt);
        }
예제 #20
0
        public void Test_SMA_DoubleArray()
        {
            Random rand = new Random(0);

            double[] xs     = DataGen.Consecutive(150);
            double[] prices = DataGen.RandomWalk(rand, xs.Length, offset: 50);
            double[] sma20  = ScottPlot.Statistics.Finance.SMA(prices, 20);
            double[] sma50  = ScottPlot.Statistics.Finance.SMA(prices, 50);

            var plt = new ScottPlot.Plot(600, 400);

            plt.PlotScatter(xs, prices, lineWidth: 0, label: "Price");
            plt.PlotScatter(xs, sma20, label: "20 day SMA", markerSize: 0, lineWidth: 2);
            plt.PlotScatter(xs, sma50, label: "50 day SMA", markerSize: 0, lineWidth: 2);

            plt.YLabel("Price");
            plt.XLabel("Days");
            plt.Legend();
            TestTools.SaveFig(plt);
        }
예제 #21
0
        public void Test_Layout_LabelsWithLineBreaks()
        {
            int pointCount = 50;

            double[] dataXs  = DataGen.Consecutive(pointCount);
            double[] dataSin = DataGen.Sin(pointCount);
            double[] dataCos = DataGen.Cos(pointCount);

            var plt = new ScottPlot.Plot();

            plt.PlotScatter(dataXs, dataSin);
            plt.PlotScatter(dataXs, dataCos);

            string labelWithLineBreak = "Line One\nLine Two";

            plt.Title(labelWithLineBreak, fontSize: 30);
            plt.XLabel(labelWithLineBreak);
            plt.YLabel(labelWithLineBreak);

            TestTools.SaveFig(plt);
        }
예제 #22
0
        public void Test_Window_Functions()
        {
            var plt = new ScottPlot.Plot(500, 400);

            double[] xs = ScottPlot.DataGen.Range(-1, 1, .01, true);
            plt.PlotScatter(xs, FftSharp.Window.Hanning(xs.Length), label: "Hanning");
            plt.PlotScatter(xs, FftSharp.Window.Hamming(xs.Length), label: "Hamming");
            plt.PlotScatter(xs, FftSharp.Window.Bartlett(xs.Length), label: "Bartlett");
            plt.PlotScatter(xs, FftSharp.Window.Blackman(xs.Length), label: "Blackman");
            //plt.PlotScatter(xs, FftSharp.Window.BlackmanExact(xs.Length), label: "BlackmanExact");
            //plt.PlotScatter(xs, FftSharp.Window.BlackmanHarris(xs.Length), label: "BlackmanHarris");
            plt.PlotScatter(xs, FftSharp.Window.FlatTop(xs.Length), label: "FlatTop");
            plt.PlotScatter(xs, FftSharp.Window.Cosine(xs.Length), label: "Cosine");

            // customize line styles post-hoc
            foreach (var p in plt.GetPlottables())
            {
                if (p is ScottPlot.PlottableScatter)
                {
                    ((ScottPlot.PlottableScatter)p).markerSize = 0;
                    ((ScottPlot.PlottableScatter)p).lineWidth  = 3;
                    var c = ((ScottPlot.PlottableScatter)p).color;
                    ((ScottPlot.PlottableScatter)p).color = System.Drawing.Color.FromArgb(200, c.R, c.G, c.B);
                }
            }

            plt.Legend(location: ScottPlot.legendLocation.upperRight);
            plt.SaveFig("../../../../../dev/windows.png");
        }
예제 #23
0
        public void Test_Step_RandomData()
        {
            Random rand = new Random(0);

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

            var plt = new ScottPlot.Plot(400, 300);

            plt.PlotStep(xs, ys);
            plt.PlotScatter(xs, ys, lineWidth: 0);
            TestTools.SaveFig(plt);
        }
예제 #24
0
        static void Main(string[] args)
        {
            //double[] xs = { 1, 2, 3, 4, 5, 6, 7 };
            //double[] ys = { 2, 2, 3, 3, 3.8, 4.2, 4 };

            //ScottPlot.Statistics.LinearRegressionLine model = new ScottPlot.Statistics.LinearRegressionLine(xs, ys);

            //Console.WriteLine(model.slope);
            //Console.WriteLine(model.offset);

            //Console.WriteLine(model.GetValueAt(3));
            //for (int i = 0; i < xs.Length; i++)
            //{
            //	Console.WriteLine(model.GetValues()[i]);
            //	Console.WriteLine(model.GetResiduals()[i]);
            //}


            //Console.Read();

            Console.WriteLine("Hello World!");

            int    count = 400;
            double step  = 0.01;

            double[] dataR     = new double[count];
            double[] dataTheta = new double[count];
            double[] dataX     = new double[count];
            double[] dataY     = new double[count];

            for (int i = 0; i < dataR.Length; i++)
            {
                dataR[i]     = 1 + (double)i * step;
                dataTheta[i] = i * 2 * Math.PI * step;
            }
            var plt = new ScottPlot.Plot(600, 400);

            (dataX, dataY) = ScottPlot.Tools.ConvertPolarCoordinates(dataR, dataTheta);

            plt.PlotScatter(dataX, dataY);
            string filename = "qucikstart.png";

            plt.SaveFig(filename);

            using (Process process = new Process())
            {            //So the photo opens automatically (you need to use xdg-open on Linux)
                process.StartInfo.FileName        = filename;
                process.StartInfo.UseShellExecute = true;
                process.Start();
            }
        }
예제 #25
0
        public void Test_Legend_Bitmap()
        {
            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");

            // the legend Bitmap should have size
            var bmpLegend1 = plt.GetLegendBitmap();

            Assert.IsNotNull(bmpLegend1);
            Assert.Greater(bmpLegend1.Width, 0);
            Assert.Greater(bmpLegend1.Height, 0);

            // add a new line to the plot
            plt.PlotScatter(DataGen.Consecutive(51), DataGen.Consecutive(51), label: "test123");

            // the legend Bitmap should be bigger now
            var bmpLegend2 = plt.GetLegendBitmap();

            Assert.Greater(bmpLegend2.Height, bmpLegend1.Height);
            Assert.Greater(bmpLegend2.Width, bmpLegend1.Width);
        }
예제 #26
0
        static void Main(string[] args)
        {
            int             N  = 10000;
            Vector <double> y0 = Vector <double> .Build.Dense(new[] { -7.0 / 4.0, 55.0 / 8.0 });

            //Func<double, Vector<double>, Vector<double>> der = DerivativeMaker();

            Vector <double>[] res = RungeKutta.FourthOrder(y0, 0, 10, N, DerivativeMaker_zzz2);

            double[] t = Vector <double> .Build.Dense(N, i => i * 10.0 / N).ToArray();

            double[] x = new double[N];
            double[] y = new double[N];
            for (int i = 0; i < N; i++)
            {
                double[] temp = res[i].ToArray();
                x[i] = temp[0];
                y[i] = temp[1];
                //Console.WriteLine(t[i]);
            }

            var plt = new ScottPlot.Plot(800, 600);

            plt.PlotScatter(t, x, label: "x", markerShape: (MarkerShape)Enum.Parse(typeof(MarkerShape), "none"));
            plt.PlotScatter(t, y, label: "y", markerShape: (MarkerShape)Enum.Parse(typeof(MarkerShape), "none"));
            plt.Grid(false);
            plt.Legend(fontSize: 10);
            //plt.PlotSignal(new[,] { x, y });
            plt.SaveFig("quickstart.png");


            //Test
            Console.WriteLine(y[N / 10]);                                           // gives 164,537981852489
            Console.WriteLine(Math.Exp(-1) + 3 * Math.Exp(4) - 5.0 / 2 + 23.0 / 8); //gives 164,537329540604, which is y(1)

            Console.ReadKey();
        }
예제 #27
0
        static void Main(string[] args)
        {
            BendStiffener bendStiffener = new BendStiffener
            {
                max_k = 0.3f,
                D1    = 0.7,
                d1    = 0.18,
                d2    = 0.2,
                L1    = 0.1,
                L2    = 2.3,
                L3    = 0.2,
                EIp   = 1e4,
                Es    = 4.5e6,
                F     = 2e4,
                q     = 0.52
            };

            int N = 10000;

            Vector <double>[] res = bendStiffener.bvpsolver_zzz(bendStiffener.Ode_to_solve, 0.0, bendStiffener.q, 0.0, 5.0, N);
            double[]          x   = Vector <double> .Build.Dense(N, i => i * 5.0 / N).ToArray();

            double[] y    = new double[N];
            double[] dydx = new double[N];

            for (int i = 0; i < N; i++)
            {
                double[] temp = res[i].ToArray();
                y[i]    = temp[0];
                dydx[i] = temp[1];
                //Console.WriteLine(t[i]);
            }
            var plt = new ScottPlot.Plot(800, 600);

            //plt.PlotScatter(x, y, label: "y", markerShape: (MarkerShape)Enum.Parse(typeof(MarkerShape), "none"));
            plt.PlotScatter(x, dydx, label: "dydx", markerShape: (MarkerShape)Enum.Parse(typeof(MarkerShape), "none"));
            plt.Grid(false);
            plt.Legend(fontSize: 10);
            //plt.PlotSignal(new[,] { x, y });
            plt.SaveFig("quickstart.png");


            Console.WriteLine("plot finished"); // gives 164,537981852489
            //Test
            //Console.WriteLine(y[N / 10]); // gives 164,537981852489
            //Console.WriteLine(Math.Exp(-1) + 3 * Math.Exp(4) - 5.0 / 2 + 23.0 / 8); //gives 164,537329540604, which is y(1)

            Console.ReadKey();
        }
예제 #28
0
        public void Test_AutoAxis_ScatterVerticalLine()
        {
            var plt = new ScottPlot.Plot();

            plt.PlotScatter(
                xs: new double[] { 1, 1 },
                ys: new double[] { 1, 2 }
                );
            plt.AxisAuto();

            var limits = plt.GetAxisLimits();

            Assert.Greater(limits.XSpan, 0);
            Assert.Greater(limits.YSpan, 0);
        }
예제 #29
0
        /// <summary>
        /// Method for plotting data to .png
        /// </summary>
        /// <param name="dataPoints"></param>
        public static void Graph(double[,] dataPoints)
        {
            double[] DataError    = new double[dataPoints.GetUpperBound(0) + 1];
            double[] DataAccuracy = new double[dataPoints.GetUpperBound(0) + 1];
            double[] dataXs       = new double[dataPoints.GetUpperBound(0) + 1];

            for (int i = 0; i < dataXs.Length; i++)
            {
                dataXs[i]       = i;
                DataError[i]    = dataPoints[i, 0];
                DataAccuracy[i] = dataPoints[i, 1];
            }

            /// plot the data
            ///

            var plt_acc  = new ScottPlot.Plot(800, 600);
            var plt_loss = new ScottPlot.Plot(800, 600);

            plt_acc.PlotScatter(dataXs, DataAccuracy, label: "Accuracy");
            plt_loss.PlotScatter(dataXs, DataError, label: "Error rate");

            plt_acc.Grid(xSpacing: 20, ySpacing: .1);
            plt_loss.Grid(xSpacing: 5, ySpacing: .1);

            plt_acc.Legend(location: legendLocation.upperLeft);
            plt_loss.Legend(location: legendLocation.upperLeft);

            plt_acc.Title("Accuracy");
            plt_loss.Title("Loss");

            plt_acc.XLabel("Epoch");
            plt_acc.YLabel("Accuracy");

            plt_loss.XLabel("Epoch");
            plt_loss.YLabel("Loss");

            plt_acc.SaveFig("NN_acc.png");
            plt_loss.SaveFig("NN_loss.png");
            Process.Start(new ProcessStartInfo(@"NN_acc.png")
            {
                UseShellExecute = true
            });
            Process.Start(new ProcessStartInfo(@"NN_loss.png")
            {
                UseShellExecute = true
            });
        }
        private void MakeAPlot(double[,] data, double[,] dataEmp)
        {
            var plt = new ScottPlot.Plot(1000, 800);

            double[] x, y1, y2, y3, y4, empX, empY1, empY2, empY3, empY4;
            int      linewidth = 2, markersize = 0;

            x  = GetColumn(data, 0);
            y1 = GetColumn(data, 1);
            y2 = GetColumn(data, 2);
            y3 = GetColumn(data, 3);
            y4 = GetColumn(data, 4);

            empX  = GetRow(dataEmp, 0);
            empY1 = GetRow(dataEmp, 1);
            empY2 = GetRow(dataEmp, 2);
            empY3 = GetRow(dataEmp, 3);
            empY4 = GetRow(dataEmp, 4);

            plt.PlotScatter(x, y1, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Green, label: "Susceptible", lineStyle: LineStyle.Dot);
            plt.PlotScatter(x, y2, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Red, label: "Infected", lineStyle: LineStyle.Dot);
            plt.PlotScatter(x, y3, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Gray, label: "Vaccinated", lineStyle: LineStyle.Dot);
            plt.PlotScatter(x, y4, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Blue, label: "Recovered", lineStyle: LineStyle.Dot);

            plt.PlotScatter(empX, empY1, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Green, label: "Susceptible emp");
            plt.PlotScatter(empX, empY2, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Red, label: "Infected emp");
            plt.PlotScatter(empX, empY3, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Gray, label: "Vaccinated emp");
            plt.PlotScatter(empX, empY4, markerSize: markersize, lineWidth: linewidth, color: System.Drawing.Color.Blue, label: "Recovered emp");


            //plt.PlotAnnotation("Population: " + N + "\nβ = " + beta + "\nγ = " + gamma, 10, 10);
            plt.Legend();
            plt.XLabel("Time");
            plt.YLabel("Population");

            image.Source = CreateBitmapSourceFromGdiBitmap(plt.GetBitmap());
        }