Beispiel #1
0
        public void Test_ManualPolygon_Render()
        {
            Random rand = new Random(0);

            var plt = new ScottPlot.Plot();

            for (int i = 0; i < 5; i++)
            {
                var color = plt.GetSettings(false).GetNextColor();

                var plottable = new ScottPlot.PlottablePolygon(
                    xs: ScottPlot.DataGen.Random(rand, 3, 100),
                    ys: ScottPlot.DataGen.Random(rand, 3, 100),
                    label: $"polygon {i + 1}",
                    lineWidth: 2,
                    lineColor: color,
                    fill: true,
                    fillColor: color,
                    fillAlpha: .5
                    );

                plt.Add(plottable);
            }

            plt.Title("Polygon Example");
            plt.Legend(location: ScottPlot.legendLocation.lowerLeft);
            TestTools.SaveFig(plt);
        }
Beispiel #2
0
        public PlottablePolygon PlotPolygon(
            double[] xs,
            double[] ys,
            string label     = null,
            double lineWidth = 0,
            Color?lineColor  = null,
            bool fill        = true,
            Color?fillColor  = null,
            double fillAlpha = 1
            )
        {
            if (lineColor is null)
            {
                lineColor = settings.GetNextColor();
            }

            if (fillColor is null)
            {
                fillColor = settings.GetNextColor();
            }

            var plottable = new ScottPlot.PlottablePolygon(
                xs: xs,
                ys: ys,
                label: label,
                lineWidth: lineWidth,
                lineColor: lineColor.Value,
                fill: fill,
                fillColor: fillColor.Value,
                fillAlpha: fillAlpha
                );

            Add(plottable);

            return(plottable);
        }