예제 #1
0
        private void LoadABF(string path)
        {
            // setup the voltage plot
            path         = Path.GetFullPath(path);
            lblPath.Text = path;
            var abf = new AbfSharp.ABF(path);

            V = abf.ReadAllSweeps();
            formsPlot1.Plot.AddSignal(V, SAMPLE_RATE, Color.Blue);
            Vline1 = formsPlot1.Plot.AddVerticalLine(0, Color.Black, style: ScottPlot.LineStyle.Dash);
            formsPlot1.Plot.AxisAuto(horizontalMargin: 0);
            formsPlot1.Plot.YLabel("mV");

            // setup the dVdt plot
            DVDT = new double[V.Length];
            for (int i = 1; i < V.Length; i++)
            {
                DVDT[i] = (V[i] - V[i - 1]) * (SAMPLE_RATE / 1000);
            }
            DVDT[0] = DVDT[1];
            formsPlot2.Plot.AddSignal(DVDT, SAMPLE_RATE, Color.Red);
            Vline2 = formsPlot2.Plot.AddVerticalLine(0, Color.Black, style: ScottPlot.LineStyle.Dash);
            formsPlot2.Plot.AxisAuto(horizontalMargin: 0);
            formsPlot2.Plot.YLabel("mV/ms");

            // setup the phase plot
            Sp        = formsPlot3.Plot.AddScatterLines(V, DVDT, Color.Gray);
            Highlight = formsPlot3.Plot.AddPoint(0, 0, Color.Black, 10, ScottPlot.MarkerShape.filledCircle);
            formsPlot3.Render(lowQuality: true);
            formsPlot3.Plot.XLabel("mV");
            formsPlot3.Plot.YLabel("mV/ms");
        }
예제 #2
0
        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();
        }
예제 #3
0
        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);
        }
예제 #4
0
        //[Test]
        public void Test_DocPlottables_CreateAndAdd()
        {
            double[] xs = { 1, 2, 3, 4, 5 };
            double[] ys = { 1, 4, 9, 16, 25 };

            var plt     = new ScottPlot.Plot(400, 300);
            var scatter = new ScottPlot.Plottable.ScatterPlot(xs, ys)
            {
                Color     = Color.Green,
                LineWidth = 2
            };

            plt.Add(scatter);

            TestTools.SaveFig(plt);

            string thisHash = ScottPlot.Tools.BitmapHash(plt.Render());

            createHash ??= thisHash;
            Assert.AreEqual(createHash, thisHash);
        }
예제 #5
0
        public static void SetPlottableProperties(
            ScottPlot.Plottable.ScatterPlot scatter,
            PlotArguments args)
        {
            // access
            if (scatter == null)
            {
                return;
            }

            // set
            if (true == args?.linewidth.HasValue)
            {
                scatter.LineWidth = args.linewidth.Value;
            }

            if (true == args?.markersize.HasValue)
            {
                scatter.MarkerSize = (float)args.markersize.Value;
            }
        }