コード例 #1
0
        public Heatmap(string title, string xTitle, string yTitle, double[,] data)
            : base(title)
        {
            var model = new PlotModel
            {
                Title = title,
            };

            OxyPalette palette   = OxyPalettes.Hot(200);
            var        colorAxis = new LinearColorAxis
            {
                InvalidNumberColor = OxyColors.Gray,
                Position           = AxisPosition.Right,
                Palette            = palette
            };

            model.Axes.Add(colorAxis);

            var xAxis = new LinearAxis
            {
                Position = AxisPosition.Bottom,
                Title    = xTitle
            };

            model.Axes.Add(xAxis);

            var yAxis = new LinearAxis
            {
                Title = yTitle
            };

            model.Axes.Add(yAxis);

            var series = new HeatMapSeries
            {
                X0       = 0,
                X1       = 1,
                Y0       = 0,
                Y1       = 1,
                FontSize = .2
            };
            int width  = data.GetLength(0);
            int height = data.GetLength(1);

            series.Data = new double[width, height];

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    series.Data[i, j] = data[i, j];
                }
            }

            model.Series.Add(series);
            Model = model;
        }
コード例 #2
0
 /// <summary>
 /// Create the palette list.
 /// </summary>
 private void CreatePaletteList()
 {
     PaletteList = new BindingList <OxyPalette>();
     PaletteList.Add(OxyPalettes.BlackWhiteRed(64));
     PaletteList.Add(OxyPalettes.BlueWhiteRed(64));
     PaletteList.Add(OxyPalettes.BlueWhiteRed31);
     PaletteList.Add(OxyPalettes.Cool(64));
     PaletteList.Add(OxyPalettes.Gray(64));
     PaletteList.Add(OxyPalettes.Hot(64));
     PaletteList.Add(OxyPalettes.Hue64);
     PaletteList.Add(OxyPalettes.HueDistinct(64));
     PaletteList.Add(OxyPalettes.Jet(64));
     PaletteList.Add(OxyPalettes.Rainbow(64));
 }
コード例 #3
0
 public static PlotModel Hot30()
 {
     return(HeatMapSeriesExamples.CreatePeaks(OxyPalettes.Hot(30), false));
 }
コード例 #4
0
        public void TestMsFeatureScatterPlot(string path1, string path2, string pngPath)
        {
            // Convert relative paths to absolute paths
            path1   = GetPath(path1);
            path2   = GetPath(path2);
            pngPath = GetPath(pngPath);

            var fiOutput    = new FileInfo(pngPath);
            var didirectory = fiOutput.Directory;

            if (didirectory == null)
            {
                throw new DirectoryNotFoundException(pngPath);
            }

            if (!didirectory.Exists)
            {
                didirectory.Create();
            }

            var aligner           = new LcmsWarpFeatureAligner(new LcmsWarpAlignmentOptions());
            var isosFilterOptions = new DeconToolsIsosFilterOptions();

            var baselineMs = UmcLoaderFactory.LoadMsFeatureData(path1, isosFilterOptions);
            var aligneeMs  = UmcLoaderFactory.LoadMsFeatureData(path2, isosFilterOptions);
            var finder     = FeatureFinderFactory.CreateFeatureFinder(FeatureFinderType.TreeBased);

            var tolerances = new FeatureTolerances
            {
                FragmentationWindowSize = .5,
                Mass      = 13,
                DriftTime = .3,
                Net       = .01
            };
            var options = new LcmsFeatureFindingOptions(tolerances);

            options.MaximumNetRange = .002;

            var baseline         = finder.FindFeatures(baselineMs, options, null);
            var alignee          = finder.FindFeatures(aligneeMs, options, null);
            var alignmentResults = aligner.Align(baseline, alignee);

            var plotModel1 = new PlotModel
            {
                Subtitle = "Interpolated, cartesian axes",
                Title    = "HeatMapSeries"
            };

            var palette          = OxyPalettes.Hot(200);
            var linearColorAxis1 = new LinearColorAxis
            {
                InvalidNumberColor = OxyColors.Gray,
                Position           = AxisPosition.Right,
                Palette            = palette
            };

            plotModel1.Axes.Add(linearColorAxis1);


            // linearColorAxis1.

            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Bottom
            };

            plotModel1.Axes.Add(linearAxis1);

            var linearAxis2 = new LinearAxis();

            plotModel1.Axes.Add(linearAxis2);

            var heatMapSeries1 = new HeatMapSeries
            {
                X0       = 0,
                X1       = 1,
                Y0       = 0,
                Y1       = 1,
                FontSize = .2
            };

            var scores = alignmentResults.HeatScores;
            var width  = scores.GetLength(0);
            var height = scores.GetLength(1);

            heatMapSeries1.Data = new double[width, height];

            var seriesData = heatMapSeries1.Data;

            for (var i = 0; i < width; i++)
            {
                for (var j = 0; j < height; j++)
                {
                    seriesData[i, j] = Convert.ToDouble(scores[i, j]);
                }
            }

            plotModel1.Series.Add(heatMapSeries1);

            var svg       = new SvgExporter();
            var svgString = svg.ExportToString(plotModel1);

            var xml = new XmlDocument();

            xml.LoadXml(svgString);
            var x   = SvgDocument.Open(xml); // Svg.SvgDocument();
            var bmp = x.Draw();

            bmp.Save(pngPath);


            var heatmap       = HeatmapFactory.CreateAlignedHeatmap(alignmentResults.HeatScores, false);
            var netHistogram  = HistogramFactory.CreateHistogram(alignmentResults.NetErrorHistogram, "NET Error", "NET Error");
            var massHistogram = HistogramFactory.CreateHistogram(alignmentResults.MassErrorHistogram, "Mass Error", "Mass Error (ppm)");

            var baseName = Path.Combine(didirectory.FullName, Path.GetFileNameWithoutExtension(fiOutput.Name));

            var encoder = new SvgEncoder();

            PlotImageUtility.SaveImage(heatmap, baseName + "_heatmap.svg", encoder);
            PlotImageUtility.SaveImage(netHistogram, baseName + "_netHistogram.svg", encoder);
            PlotImageUtility.SaveImage(massHistogram, baseName + "_massHistogram.svg", encoder);
        }
コード例 #5
0
ファイル: OxyPaletteMap.cs プロジェクト: picowatt/Atreyu
        public static OxyPaletteMap CreateFromName(string name)
        {
            OxyPalette palette   = null;
            var        numPoints = 2;

            switch (name)
            {
            case "BlackWhiteRed":
            {
                numPoints = 3;
                palette   = OxyPalettes.BlackWhiteRed(NUM_COLORS);
                break;
            }

            case "BlueWhiteRed":
            {
                numPoints = 3;
                palette   = OxyPalettes.BlueWhiteRed(NUM_COLORS);
                break;
            }

            case "Cool":
            {
                numPoints = 3;
                palette   = OxyPalettes.Cool(NUM_COLORS);
                break;
            }

            case "Gray":
            {
                numPoints = 2;
                palette   = OxyPalettes.Gray(NUM_COLORS);
                break;
            }

            case "Hot":
            {
                numPoints = 5;
                palette   = OxyPalettes.Hot(NUM_COLORS);
                break;
            }

            case "Hue":
            {
                numPoints = 7;
                palette   = OxyPalettes.Hue(NUM_COLORS);
                break;
            }

            case "Jet":
            {
                numPoints = 5;
                palette   = OxyPalettes.Jet(NUM_COLORS);
                break;
            }

            case "Rainbow":
            {
                numPoints = 7;
                palette   = OxyPalettes.Rainbow(NUM_COLORS);
                break;
            }

            default:
            {
                return(null);

                break;
            }
            }
            var colorPoints = new Color[7];
            var brush       = new LinearGradientBrush();

            brush.StartPoint = new Point(0, 0.5);
            brush.EndPoint   = new Point(1, 0.5);
            var division = (NUM_COLORS / (numPoints - 1)) - 1;

            for (int i = 0; i < numPoints; i++)
            {
                var oxyColor = palette.Colors[(division * i)];
                colorPoints[i] = Color.FromArgb(oxyColor.A, oxyColor.R, oxyColor.G, oxyColor.B);
                brush.GradientStops.Add(new GradientStop(colorPoints[i], ((double)i / (numPoints - 1))));
            }

            return(new OxyPaletteMap(name, brush, palette));
        }
コード例 #6
0
        private static PlotModel GetPlot(string name)
        {
            // RESOLUTION AND TICK SIZE
            int dpi = (int)(dpi_min + _random.NextDouble() * (dpi_max - dpi_min));

            int[] figsize = new[] { (int)(figsize_min + _random.NextDouble() * (figsize_max - figsize_min)), (int)(figsize_min + _random.NextDouble() * (figsize_max - figsize_min)) };

            List <double> tick_size = new List <double> {
                (tick_size_width_min + _random.NextDouble() * (tick_size_width_max - tick_size_width_min)), (tick_size_length_min + _random.NextDouble() * (tick_size_length_max - tick_size_length_min))
            };

            tick_size.Sort();

            // ACTUAL POINTS
            var points_nb     = (int)(points_nb_min + (Math.Pow(_random.NextDouble(), 1.5)) * (points_nb_max - points_nb_min));
            var x_scale       = (int)(x_min_top + _random.NextDouble() * (x_max_top - x_min_top));
            var y_scale       = (int)(y_min_top + _random.NextDouble() * (y_max_top - y_min_top));
            var x_scale_range = x_scale + (int)(_random.NextDouble() * x_scale_range_max);
            var y_scale_range = y_scale + (int)(_random.NextDouble() * y_scale_range_max);
            var x_min_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, x_scale);
            var x_max_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, x_scale_range);
            var x_min         = Math.Min(x_min_temp, x_max_temp);
            var x_max         = Math.Max(x_min_temp, x_max_temp);
            var y_min_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, y_scale);
            var y_max_temp    = (-_random.NextDouble() + _random.NextDouble()) * Math.Pow(10, y_scale_range);
            var y_min         = Math.Min(y_min_temp, y_max_temp);
            var y_max         = Math.Max(y_min_temp, y_max_temp);

            var xs = UniformContinuousDistribution.Random(x_min, x_max, points_nb, _random);

            double[] ys = new double[0];

            var distribution = Resources.point_dist[_random.Next(4)];

            if (distribution == "uniform")
            {
                ys = UniformContinuousDistribution.Random(y_min, y_max, points_nb, _random);
            }
            else if (distribution == "linear")
            {
                ys = xs.Multiply((Math.Max(y_max, -y_min) / (Math.Max(x_max, -x_min)))).Multiply((double)Resources.updown[_random.Next(2)])
                     .Add(UniformContinuousDistribution.Random(0, 1, points_nb, _random).Add(y_min).Multiply((y_max - y_min)).Multiply(_random.NextDouble() / 2.0));
            }
            else if (distribution == "quadratic")
            {
                ys = xs.Pow(2).Multiply(1.0 / (Math.Max(x_max, -x_min))).Pow(2).Multiply(Math.Max(y_max, -y_min)).Multiply((double)Resources.updown[_random.Next(2)])
                     .Add(UniformContinuousDistribution.Random(0, 1, points_nb, _random).Add(y_min).Multiply((y_max - y_min)).Multiply(_random.NextDouble() / 2.0));
            }
            else if (distribution == "binormal")
            {
                double stdDev = Math.Max(y_max, -y_min) / Math.Max(x_max, -x_min);
                double correl = (double)Resources.updown[_random.Next(2)] * _random.NextDouble();
                xs = NormalDistribution.Random(x_max - x_min, stdDev, points_nb, _random);
                ys = correl.Multiply(xs).Add(NormalDistribution.Random(y_max - y_min, stdDev, points_nb, _random).Multiply(Math.Sqrt(1 - correl * correl)));
            }

            // POINTS VARIATION
            var nb_points_var         = 1 + (int)(_random.NextDouble() * max_points_variations);
            var nb_points_var_colors  = 1 + (int)(_random.NextDouble() * nb_points_var);
            var nb_points_var_markers = 1 + (int)(_random.NextDouble() * (nb_points_var - nb_points_var_colors));
            var nb_points_var_size    = Math.Max(1, 1 + nb_points_var - nb_points_var_colors - nb_points_var_markers);

            var rand_color_number = _random.NextDouble();

            OxyColor[] colors = new OxyColor[nb_points_var_colors];
            OxyColor[] tempPalette;
            if (rand_color_number <= 0.5)
            {
                tempPalette = OxyPalettes.Rainbow(nb_points_var_colors * 20).Colors.ToArray();
            }
            else if (rand_color_number > 0.5 && rand_color_number <= 0.7)
            {
                tempPalette = OxyPalettes.Hue(nb_points_var_colors * 20).Colors.ToArray(); // gnuplot
            }
            else if (rand_color_number > 0.7 && rand_color_number <= 0.8)
            {
                tempPalette = OxyPalettes.Hot(nb_points_var_colors * 20).Colors.ToArray(); // copper
            }
            else
            {
                tempPalette = OxyPalettes.Jet(nb_points_var_colors * 20).Colors.ToArray(); // gray
            }

            for (int i = 0; i < nb_points_var_colors; i++)
            {
                colors[i] = tempPalette[_random.Next(nb_points_var_colors * 20)];
            }

            var s_set          = (size_points_min.Add(UniformContinuousDistribution.Random(0, 1, nb_points_var_size, _random).Multiply(size_points_max - size_points_min)));
            var markers_subset = new List <MarkerType>();

            for (int i = 0; i < nb_points_var_markers; i++)
            {
                markers_subset.Add(Resources.Markers[_random.Next(Resources._markersCount)]);
            }

            var markers_empty       = _random.NextDouble() > 0.75;
            var markers_empty_ratio = new[] { 0.0, 0.5, 0.7 }[_random.Next(3)];



            // PAD BETWEEN TICKS AND LABELS
            double    pad_x             = Math.Max(tick_size[1] + 0.5, (int)(pad_min + _random.NextDouble() * (pad_max - pad_min)));
            double    pad_y             = Math.Max(tick_size[1] + 0.5, (int)(pad_min + _random.NextDouble() * (pad_max - pad_min)));
            TickStyle direction_ticks_x = Resources.DirectionTicks[_random.Next(Resources._directionTicksCount)];
            TickStyle direction_ticks_y = Resources.DirectionTicks[_random.Next(Resources._directionTicksCount)];

            // FONT AND SIZE FOR LABELS (tick labels, axes labels and title)
            string font       = Resources.FontList[_random.Next(Resources._fontListCount)];
            int    size_ticks = (int)(tick_label_size_min + _random.NextDouble() * (tick_label_size_max - tick_label_size_min));
            int    size_axes  = (int)(axes_label_size_min + _random.NextDouble() * (axes_label_size_max - axes_label_size_min));
            int    size_title = (int)(title_size_min + _random.NextDouble() * (title_size_max - title_size_min));
            //var ticks_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_ticks, weight = 'normal', stretch = 'normal');
            //var axes_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_axes, weight = 'normal', stretch = 'normal');
            //var title_font = font_manager.FontProperties(fname = font, style = 'normal', size = size_title, weight = 'normal', stretch = 'normal');

            // TEXTS FOR AXIS LABELS AND TITLE
            int    label_x_length = (int)(axes_label_length_min + _random.NextDouble() * (axes_label_length_max - axes_label_length_min));
            int    label_y_length = (int)(axes_label_length_min + _random.NextDouble() * (axes_label_length_max - axes_label_length_min));
            int    title_length   = (int)(title_length_min + _random.NextDouble() * (title_length_max - title_length_min));
            string x_label        = RandomString(label_x_length);
            string y_label        = RandomString(label_y_length);
            string title          = RandomString(title_length);

            // BUILDING THE PLOT
            PlotModel model = new PlotModel
            {
                Title                   = title,
                TitleFont               = font,
                TitleFontSize           = size_title,
                DefaultColors           = colors,
                PlotAreaBorderThickness = new OxyThickness(0)
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.None, Palette = new OxyPalette(colors), Minimum = 0, Maximum = colors.Length - 1
            });

            // TICKS STYLE AND LOCATION (X AXIS)
            LineStyle lineStyle = Resources.LineStyles[_random.Next(Resources._lineStylesCount)];
            var       xAxis     = new LinearAxis
            {
                Position           = _random.NextDouble() > 0.5 ? AxisPosition.Top : AxisPosition.Bottom,
                TickStyle          = direction_ticks_x,
                MajorGridlineStyle = lineStyle,
                MajorTickSize      = tick_size[1],
                MinorTickSize      = (_random.NextDouble() > 77) ? 0.75 * _random.NextDouble() * tick_size[1] : 0,
                Angle                  = _random.NextDouble() > 0.77 ? _random.NextDouble() * (double)Resources.updown[_random.Next(2)] * 90 : 0,
                Font                   = font,
                FontSize               = size_ticks,
                TitleFont              = font,
                TitleFontSize          = size_axes,
                Title                  = _random.NextDouble() > 0.80 ? "" : x_label,
                PositionAtZeroCrossing = (_random.NextDouble() > 0.77),
                IsAxisVisible          = true,
                AxislineColor          = OxyColors.Black,
                AxislineStyle          = LineStyle.Solid
            };

            model.Axes.Add(xAxis);

            // TICKS STYLE AND LOCATION (Y AXIS)
            var yAxis = new LinearAxis
            {
                Position           = _random.NextDouble() > 0.5 ? AxisPosition.Right : AxisPosition.Left,
                TickStyle          = direction_ticks_y,
                MajorGridlineStyle = lineStyle,
                MajorTickSize      = tick_size[1],
                MinorTickSize      = (_random.NextDouble() > 77) ? 0.75 * _random.NextDouble() * tick_size[1] : 0,
                Angle                  = _random.NextDouble() > 0.77 ? _random.NextDouble() * 90 : 0,
                Font                   = font,
                FontSize               = size_ticks,
                TitleFont              = font,
                TitleFontSize          = size_axes,
                Title                  = _random.NextDouble() > 0.80 ? "" : y_label,
                PositionAtZeroCrossing = (_random.NextDouble() > 0.77),
                IsAxisVisible          = true,
                AxislineColor          = OxyColors.Black,
                AxislineStyle          = LineStyle.Solid
            };

            model.Axes.Add(yAxis);

            MarkerType markerType = Resources.Markers[_random.Next(Resources._markersCount)];

            var scatterSerie = new ScatterSeries()
            {
                MarkerType            = markerType,
                MarkerStrokeThickness = _random.Next(10, 31) / 10,
            };

            if (markerType != MarkerType.Cross && markerType != MarkerType.Plus && markerType != MarkerType.Star)
            {
                if (_random.NextDouble() > 0.5)
                {
                    scatterSerie.MarkerStroke = OxyColors.Black;
                }
            }

            List <double> s = new List <double>();

            for (int i = 0; i < points_nb; i++)
            {
                var s_ = s_set[_random.Next(s_set.Length)];
                var c_ = colors[_random.Next(colors.Length)];
                var m_ = Resources.Markers[_random.Next(Resources._markersCount)];

                bool e_ = false;

                if (markers_empty)
                {
                    e_ = _random.NextDouble() > markers_empty_ratio;
                }

                scatterSerie.Points.Add(new ScatterPoint(xs[i], ys[i], s_, _random.Next(colors.Length)));
            }

            model.Series.Add(scatterSerie);
            return(model);
        }
コード例 #7
0
        public void TestSimpleCreation()
        {
            var plotModel1 = new PlotModel
            {
                PlotType = PlotType.Cartesian,
                Subtitle = "Interpolated, cartesian axes",
                Title    = "HeatMapSeries"
            };

            var palette          = OxyPalettes.Hot(200);
            var linearColorAxis1 = new LinearColorAxis
            {
                InvalidNumberColor = OxyColors.Gray,
                Position           = AxisPosition.Right,
                Palette            = palette
            };

            plotModel1.Axes.Add(linearColorAxis1);

            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Bottom
            };

            plotModel1.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis();

            plotModel1.Axes.Add(linearAxis2);
            var heatMapSeries1 = new HeatMapSeries
            {
                X0       = 0.0,
                X1       = 1.0,
                Y0       = 0.0,
                Y1       = 1.0,
                FontSize = .2,
                Data     = new Double[2, 3]
            };

            //heatMapSeries1.LabelFontSize = 0.2;
            heatMapSeries1.Data[0, 0] = 0;
            heatMapSeries1.Data[0, 1] = 10.2;
            heatMapSeries1.Data[0, 2] = 20.4;
            heatMapSeries1.Data[1, 0] = 0.1;
            heatMapSeries1.Data[1, 1] = 0.3;
            heatMapSeries1.Data[1, 2] = 0.2;
            plotModel1.Series.Add(heatMapSeries1);

            var svg       = new SvgExporter();
            var svgString = svg.ExportToString(plotModel1);

            var xml = new XmlDocument();

            xml.LoadXml(svgString);
            var x   = SvgDocument.Open(xml); // Svg.SvgDocument();
            var bmp = x.Draw();

            bmp.Save(GetPath(HEATMAP_RESULTS_FOLDER_BASE + "testbmp.jpg"));

            var encoder = new PngPlotModelEncoder();

            encoder.SaveImage(plotModel1, GetPath(HEATMAP_RESULTS_FOLDER_BASE + "mine.png"));
        }
コード例 #8
0
        public void TestLcmsWarpAlignment(string path1, string path2, string svgPath)
        {
            // Convert relative paths to absolute paths
            path1   = GetPath(path1);
            path2   = GetPath(path2);
            svgPath = GetPath(HEATMAP_RESULTS_FOLDER_BASE + svgPath);

            var aligner           = new LcmsWarpFeatureAligner(new LcmsWarpAlignmentOptions());
            var isosFilterOptions = new DeconToolsIsosFilterOptions();

            var baselineMs = UmcLoaderFactory.LoadMsFeatureData(path1, isosFilterOptions);
            var aligneeMs  = UmcLoaderFactory.LoadMsFeatureData(path2, isosFilterOptions);
            var finder     = FeatureFinderFactory.CreateFeatureFinder(FeatureFinderType.TreeBased);

            var tolerances = new FeatureTolerances
            {
                FragmentationWindowSize = .5,
                Mass      = 13,
                DriftTime = .3,
                Net       = .01
            };
            var options = new LcmsFeatureFindingOptions(tolerances)
            {
                MaximumNetRange = .002
            };

            var baseline = finder.FindFeatures(baselineMs, options, null);
            var alignee  = finder.FindFeatures(aligneeMs, options, null);
            var data     = aligner.Align(baseline, alignee);

            var plotModel1 = new PlotModel
            {
                Subtitle = "Interpolated, cartesian axes",
                Title    = "HeatMapSeries"
            };

            var palette          = OxyPalettes.Hot(200);
            var linearColorAxis1 = new LinearColorAxis
            {
                InvalidNumberColor = OxyColors.Gray,
                Position           = AxisPosition.Right,
                Palette            = palette
            };

            plotModel1.Axes.Add(linearColorAxis1);


            // linearColorAxis1.

            var linearAxis1 = new LinearAxis {
                Position = AxisPosition.Bottom
            };

            plotModel1.Axes.Add(linearAxis1);

            var linearAxis2 = new LinearAxis();

            plotModel1.Axes.Add(linearAxis2);

            var heatMapSeries1 = new HeatMapSeries
            {
                X0       = 0,
                X1       = 1,
                Y0       = 0,
                Y1       = 1,
                FontSize = .2
            };

            var scores = data.HeatScores;
            var width  = scores.GetLength(0);
            var height = scores.GetLength(1);

            heatMapSeries1.Data = new double[width, height];


            for (var i = 0; i < width; i++)
            {
                for (var j = 0; j < height; j++)
                {
                    heatMapSeries1.Data[i, j] = Convert.ToDouble(scores[i, j]);
                }
            }

            plotModel1.Series.Add(heatMapSeries1);


            var svg       = new SvgExporter();
            var svgString = svg.ExportToString(plotModel1);

            using (var writer = File.CreateText(svgPath + ".svg"))
            {
                writer.Write(svgString);
            }
        }
コード例 #9
0
 public static PlotModel ColorMapHot16Big()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(31000, OxyPalettes.Hot(16), MarkerType.Square, AxisPosition.Right, OxyColors.Undefined, OxyColors.Undefined));
 }
コード例 #10
0
 public static PlotModel ColorMapHot64ExtremeTopLegend()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Hot(64), MarkerType.Cross, AxisPosition.Top, OxyColors.Magenta, OxyColors.Green));
 }
コード例 #11
0
 public static PlotModel ColorMapHot64Extreme()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Hot(64), MarkerType.Square, AxisPosition.Right, OxyColors.Magenta, OxyColors.Green));
 }
コード例 #12
0
 public static PlotModel ColorMapHot64()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Hot(64), MarkerType.Triangle, AxisPosition.Right, OxyColors.Undefined, OxyColors.Undefined));
 }
コード例 #13
0
 public static PlotModel ColorMapHot16Big()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(31000, OxyPalettes.Hot(16)));
 }
コード例 #14
0
 public static PlotModel ColorMapHot64()
 {
     return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Hot(64), MarkerType.Triangle));
 }
コード例 #15
0
        public static PlotModel CategorizedHeatMap()
        {
            var model = new PlotModel {
                Title = "Cakes per Weekday"
            };

            // Weekday axis (horizontal)
            model.Axes.Add(new CategoryAxis
            {
                Position = AxisPosition.Bottom,

                // Key used for specifying this axis in the HeatMapSeries
                Key = "WeekdayAxis",

                // Array of Categories (see above), mapped to one of the coordinates of the 2D-data array
                ItemsSource = new[]
                {
                    "Monday",
                    "Tuesday",
                    "Wednesday",
                    "Thursday",
                    "Friday",
                    "Saturday",
                    "Sunday"
                }
            });

            // Cake type axis (vertical)
            model.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Left,
                Key         = "CakeAxis",
                ItemsSource = new[]
                {
                    "Apple cake",
                    "Baumkuchen",
                    "Bundt cake",
                    "Chocolate cake",
                    "Carrot cake"
                }
            });

            // Color axis
            model.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Hot(200)
            });

            var rand = new Random();
            var data = new double[7, 5];

            for (int x = 0; x < 5; ++x)
            {
                for (int y = 0; y < 7; ++y)
                {
                    data[y, x] = rand.Next(0, 200) * (0.13 * (y + 1));
                }
            }

            var heatMapSeries = new HeatMapSeries
            {
                X0            = 0,
                X1            = 6,
                Y0            = 0,
                Y1            = 4,
                XAxisKey      = "WeekdayAxis",
                YAxisKey      = "CakeAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2, // neccessary to display the label
                Data          = data
            };

            model.Series.Add(heatMapSeries);
            return(model);
        }