Exemplo n.º 1
0
        public LinkedPlots()
        {
            InitializeComponent();
            formsPlot1.Plot.AddSignal(DataGen.Sin(51));
            formsPlot2.Plot.AddSignal(DataGen.Cos(51));

            // create a list of plot controls we can easily iterate through later
            FormsPlots = new PlotView[] { formsPlot1, formsPlot2 };
            foreach (var fp in FormsPlots)
            {
                fp.AxesChanged += OnAxesChanged;
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
            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.Frame(left: true, bottom: true, top: false, right: false);
            }
Exemplo n.º 4
0
            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.PlotText("demo text", 10, .5, fontName: "comic sans ms", fontSize: 42, color: Color.Magenta, bold: true);
            }
Exemplo n.º 5
0
            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, rulerModeY: true);
            }
Exemplo n.º 6
0
            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(ScottPlot.Style.Blue2);
            }
Exemplo n.º 7
0
            public System.Drawing.Bitmap Render(int width, int height)
            {
                Random rand = new Random(0);

                var mp = new MultiPlot(width: width, height: height, rows: 2, cols: 2);

                mp.GetSubplot(0, 0).PlotSignal(DataGen.Sin(50));
                mp.GetSubplot(0, 1).PlotSignal(DataGen.Cos(50));
                mp.GetSubplot(1, 0).PlotSignal(DataGen.Random(rand, 50));
                mp.GetSubplot(1, 1).PlotSignal(DataGen.RandomWalk(rand, 50));

                return(mp.GetBitmap());
            }
Exemplo n.º 8
0
        private void FormsPlotConfig_Load(object sender, EventArgs e)
        {
            int pointCount = 51;

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

            formsPlot1.Plot.AddScatter(dataXs, dataSin);
            formsPlot1.Plot.AddScatter(dataXs, dataCos);

            formsPlot1.Render();
        }
Exemplo n.º 9
0
        public void ExecuteRecipe(Plot plt)
        {
            // plot sample data
            plt.AddSignal(DataGen.Sin(51));
            plt.AddSignal(DataGen.Cos(51));

            // remove traditional scale indicators
            plt.Grid(enable: false);
            plt.Frameless();

            // add an L-shaped scalebar
            plt.AddScaleBar(5, .25, "100 ms", "250 mV");
        }
Exemplo n.º 10
0
        public void Test_FigureBackground_SupportsTransparency()
        {
            var plt = new ScottPlot.Plot(600, 400);

            plt.PlotSignal(DataGen.Sin(51));

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

            plt.Style(figBg: Color.Transparent);
            var mean2 = TestTools.MeanPixel(plt.GetBitmap());

            Assert.Less(mean2.A, mean1.A);
        }
Exemplo n.º 11
0
            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.Grid(xSpacing: 2, ySpacing: .1);
            }
Exemplo n.º 12
0
            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.Grid(lineStyle: ScottPlot.LineStyle.Dot);
            }
Exemplo n.º 13
0
            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.Grid(enable: false);
            }
Exemplo n.º 14
0
            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(xTickRotation: 90);
            }
Exemplo n.º 15
0
            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.AxisAuto(horizontalMargin: 0, verticalMargin: 0.5);
            }
Exemplo n.º 16
0
        public void ExecuteRecipe(Plot plt)
        {
            // plot sample data
            plt.AddSignal(DataGen.Sin(51));
            plt.AddSignal(DataGen.Cos(51));

            // add axis lines
            plt.AddHorizontalLine(.85);
            plt.AddVerticalLine(23);

            // customize axis lines with optional arguments
            plt.AddVerticalLine(x: 33, color: Color.Magenta, width: 3, style: LineStyle.Dot);
        }
Exemplo n.º 17
0
            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.AxisZoom(2, 2);
            }
Exemplo n.º 18
0
        public void Test_HiddenLines_RenderAsThickAsMarkers()
        {
            var mplt = new MultiPlot(800, 300, 1, 2);

            mplt.GetSubplot(0, 0).PlotSignal(DataGen.Sin(10000), markerSize: 10);
            mplt.GetSubplot(0, 0).Title("Zoomed Out");

            mplt.GetSubplot(0, 1).PlotSignal(DataGen.Sin(10000), markerSize: 10);
            mplt.GetSubplot(0, 1).Title("Zoomed In");
            mplt.GetSubplot(0, 1).Axis(0, 20, -.1, .1);

            TestTools.SaveFig(mplt);
        }
Exemplo n.º 19
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.AddSignal(DataGen.Sin(51));
            plt.AddSignal(DataGen.Cos(51));
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");
            plt.Title("Plot Title");
            plt.Style(figureBackground: Color.SkyBlue);

            // 25% horizontal padding means data occupies 75% of horizontal space
            // 40% vertical padding means data occupies 60% of vertical space
            plt.Margins(x: .25, y: .4);
        }
Exemplo n.º 20
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            wpfPlot1.plt.PlotSignal(DataGen.Sin(51));
            wpfPlot1.plt.PlotSignal(DataGen.Cos(51));

            wpfPlot1.plt.Ticks(false, false);
            wpfPlot1.plt.Frame(false);
            wpfPlot1.plt.TightenLayout(padding: 0);
            wpfPlot1.Configure(recalculateLayoutOnMouseUp: false);
            wpfPlot1.plt.Style(ScottPlot.Style.Gray2);

            wpfPlot1.Render();
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
0
            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.SetAxisLimits(-10, 60, -3, 3);
            }
Exemplo n.º 23
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.Palette = ScottPlot.Drawing.Palette.Frost;

            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);
        }
Exemplo n.º 24
0
            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);

                // See https://tinyurl.com/y86clj9k to learn about numeric format strings
                plt.Ticks(numericFormatStringX: "E2", numericFormatStringY: "P1");
            }
Exemplo n.º 25
0
        public void ExecuteRecipe(Plot plt)
        {
            // plot sample data
            plt.AddSignal(DataGen.Sin(51));
            plt.AddSignal(DataGen.Cos(51));

            // hide just the horizontal axis ticks
            plt.XAxis.Ticks(false);

            // hide the lines on the bottom, right, and top of the plot
            plt.XAxis.Line(false);
            plt.YAxis2.Line(false);
            plt.XAxis2.Line(false);
        }
Exemplo n.º 26
0
        public static void PlotLineSeries(Plot plt, Colormap cmap)
        {
            int lineCount = 7;

            plt.Clear();
            for (int i = 0; i < lineCount; i++)
            {
                double   fraction = (double)i / lineCount;
                double[] ys       = DataGen.Sin(100, 2, mult: 1 + fraction * 2);
                Color    c        = cmap.GetColor(fraction);
                plt.PlotSignal(ys, color: c);
            }
            plt.AxisAuto();
        }
Exemplo n.º 27
0
        public void ExecuteRecipe(Plot plt)
        {
            double[] ys = DataGen.Sin(50);
            plt.AddSignal(ys);

            var tt = plt.AddTooltip("This point has\na negative slope", 25, ys[25]);

            tt.Font.Size   = 24;
            tt.Font.Color  = System.Drawing.Color.White;
            tt.FillColor   = System.Drawing.Color.Blue;
            tt.BorderWidth = 5;
            tt.BorderColor = System.Drawing.Color.Navy;
            tt.ArrowSize   = 15;
        }
Exemplo n.º 28
0
            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);
            }
Exemplo n.º 29
0
            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");
            }
Exemplo n.º 30
0
            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(figBg: Color.LightBlue);
                plt.Style(dataBg: Color.LightYellow);
            }