Exemple #1
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] data2D = { { 1, 2, 3 },
                                 { 4, 5, 6 } };

            var hm = plt.AddHeatmap(data2D);
            var cb = plt.AddColorbar(hm);
        }
Exemple #2
0
        public void ExecuteRecipe(Plot plt)
        {
            var cb = plt.AddColorbar();

            cb.AddTick(0, "-123");
            cb.AddTick(1, "+123");
            cb.AddTick(.5, "0");
            cb.AddTick(.25, "-61.5");
            cb.AddTick(.75, "+61.5");
        }
Exemple #3
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] data2D = { { 1, 2, 3 },
                                 { 4, 5, 6 } };

            var hm = plt.AddHeatmap(data2D, lockScales: false);
            var cb = plt.AddColorbar(hm);

            plt.Margins(0, 0);
        }
Exemple #4
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.AddColorbar(Drawing.Colormap.Turbo);

            // direct attention to the colorbar
            var text = plt.AddText("Colorbar", 5, 0, 24, Color.Red);

            text.Alignment = Alignment.MiddleRight;
            plt.AddArrow(7, 0, 5, 0, color: Color.Red);
            plt.SetAxisLimits(-10, 10, -10, 10);
        }
Exemple #5
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] imageData = DataGen.SampleImageData();
            var heatmap = plt.AddHeatmap(imageData);

            heatmap.Update(imageData, min: 75, max: 125);

            var cb = plt.AddColorbar(heatmap);

            // configure the colorbar to display inequality operators at the edges
            cb.MaxIsClipped = true;
            cb.MinIsClipped = true;
        }
Exemple #6
0
        public void ExecuteRecipe(Plot plt)
        {
            Random rand = new Random(0);

            int[] xs = DataGen.RandomNormal(rand, 10000, 25, 10).Select(x => (int)x).ToArray();
            int[] ys = DataGen.RandomNormal(rand, 10000, 25, 10).Select(y => (int)y).ToArray();

            double[,] intensities = Tools.XYToIntensities(mode: IntensityMode.Gaussian,
                                                          xs: xs, ys: ys, width: 50, height: 50, sampleWidth: 4);

            var hm = plt.AddHeatmap(intensities);
            var cb = plt.AddColorbar(hm);
        }
Exemple #7
0
        public void ExecuteRecipe(Plot plt)
        {
            double?[,] intensities =
            {
                {    1,    7,    4, null },
                {    9, null,    2,    4 },
                {    1,    4, null,    8 },
                { null,    2,    4, null }
            };

            var hmc = plt.AddHeatmap(intensities);
            var cb  = plt.AddColorbar(hmc);
        }
Exemple #8
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] intensities = new double[100, 100];
            for (int x = 0; x < 100; x++)
            {
                for (int y = 0; y < 100; y++)
                {
                    intensities[x, y] = (Math.Sin(x * .2) + Math.Cos(y * .2)) * 100;
                }
            }

            var hm = plt.AddHeatmap(intensities, Drawing.Colormap.Turbo);
            var cb = plt.AddColorbar(hm);
        }
Exemple #9
0
        public void ExecuteRecipe(Plot plt)
        {
            var cb = plt.AddColorbar(Drawing.Colormap.Turbo);

            cb.MinValue     = -10;
            cb.MaxValue     = 10;
            cb.MinIsClipped = true;
            cb.MaxIsClipped = true;

            // direct attention to the colorbar
            var text = plt.AddText("Colorbar", 5, 0, 24, Color.Red);

            text.Alignment = Alignment.MiddleRight;
            plt.AddArrow(7, 0, 5, 0, color: Color.Red);
            plt.SetAxisLimits(-10, 10, -10, 10);
        }
Exemple #10
0
        public void ExecuteRecipe(Plot plt)
        {
            var cmap = ScottPlot.Drawing.Colormap.Viridis;

            plt.AddColorbar(cmap);

            Random rand = new(0);

            for (int i = 0; i < 1000; i++)
            {
                double x               = ScottPlot.DataGen.RandomNormalValue(rand, mean: 0, stdDev: .5);
                double y               = ScottPlot.DataGen.RandomNormalValue(rand, mean: 0, stdDev: .5);
                double colorFraction   = Math.Sqrt(x * x + y * y);
                System.Drawing.Color c = ScottPlot.Drawing.Colormap.Viridis.GetColor(colorFraction);
                plt.AddPoint(x, y, c);
            }
        }
Exemple #11
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] intensities = new double[100, 100];
            for (int x = 0; x < 100; x++)
            {
                for (int y = 0; y < 100; y++)
                {
                    intensities[x, y] = (Math.Sin(x * .2) + Math.Cos(y * .2)) * 100;
                }
            }

            var hm = plt.AddHeatmap(intensities);

            hm.Update(intensities, min: 0, max: 200);

            var cb = plt.AddColorbar(hm);
        }
Exemple #12
0
        public void ExecuteRecipe(Plot plt)
        {
            int width  = 100;
            int height = 100;

            double[,] intensities = new double[width, height];

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    intensities[x, y] = (Math.Sin(x * .2) + Math.Cos(y * .2)) * 100;
                }
            }

            var hm = plt.AddHeatmap(intensities);
            var cb = plt.AddColorbar(hm);
        }
Exemple #13
0
        public void ExecuteRecipe(Plot plt)
        {
            var cb = plt.AddColorbar(Drawing.Colormap.Turbo);

            // Add manual ticks (disabling automatic ticks)
            cb.AddTick(0, "-123");
            cb.AddTick(1, "+123");
            cb.AddTick(.5, "0");
            cb.AddTick(.25, "-61.5");
            cb.AddTick(.75, "+61.5");

            // To re-enable automatic ticks call cb.AutomaticTicks(true)

            // direct attention to the colorbar
            var text = plt.AddText("Colorbar", 5, 0, 24, Color.Red);

            text.Alignment = Alignment.MiddleRight;
            plt.AddArrow(7, 0, 5, 0, color: Color.Red);
            plt.SetAxisLimits(-10, 10, -10, 10);
        }
Exemple #14
0
        public void ExecuteRecipe(Plot plt)
        {
            double[,] intensities = new double[100, 100];
            for (int x = 0; x < 100; x++)
            {
                for (int y = 0; y < 100; y++)
                {
                    intensities[x, y] = (Math.Sin(x * .2) + Math.Cos(y * .2)) * 100;
                }
            }

            // scale the colors between 0 and 200
            var hm = plt.AddHeatmap(intensities);

            hm.Update(intensities, min: 0, max: 200);

            // add a colorbar with custom ticks
            var cb = plt.AddColorbar(hm);

            double[] tickPositions = ScottPlot.DataGen.Range(0, 200, 25, true);
            string[] tickLabels    = tickPositions.Select(x => x.ToString()).ToArray();
            cb.SetTicks(tickPositions, tickLabels, min: 0, max: 200);
        }
Exemple #15
0
 public void ExecuteRecipe(Plot plt)
 {
     plt.AddColorbar();
 }
Exemple #16
0
 public void ExecuteRecipe(Plot plt)
 {
     plt.AddColorbar(rightSide: false);
 }
Exemple #17
0
 public void ExecuteRecipe(Plot plt)
 {
     plt.AddColorbar(Drawing.Colormap.Turbo);
 }