public PlotModel MagnifierGrayImage(Image <Gray, byte> grayImage)
        {
            CreateAxisForPlot();

            plotImage.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Gray(255)
            });

            var data = GenerateGrayPixel(grayImage);

            var heatMapSeries = new HeatMapSeries
            {
                X0            = 0,
                X1            = 8,
                Y0            = 0,
                Y1            = 8,
                XAxisKey      = "xAxis",
                YAxisKey      = "yAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2,
                Data          = data
            };

            plotImage.Series.Add(heatMapSeries);

            return(plotImage);
        }
        private async Task Initialize()
        {
            var x0 = -3.5;
            var x1 = 2.4;
            var y0 = -4.0;
            var y1 = 4;
            var n  = 100;

            var puntosRastrigin = await MockDatabase.ObtenerPuntosRastrigin(x0, x1, y0, y1, n);

            var serie = new HeatMapSeries
            {
                X0    = x0,
                X1    = x1,
                Y0    = y0,
                Y1    = y1,
                Data  = puntosRastrigin,
                Title = "Rastrigin"
            };

            ChartModel.Series.Add(serie);
            ChartModel.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });
        }
Exemplo n.º 3
0
        public static PlotModel LogXNotInterpolated()
        {
            var data = new double[11, 21];

            double k = Math.Pow(2, 0.1);

            for (int i = 0; i < 11; i++)
            {
                for (int j = 0; j < 21; j++)
                {
                    data[i, j] = Math.Pow(k, (double)i) * (double)j / 40.0;
                }
            }

            var model = new PlotModel {
                Title = "Logarithmic X, discrete rectangles"
            };

            model.Axes.Add(new LogarithmicAxis {
                Position = AxisPosition.Bottom
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });
            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Gray(500), HighColor = OxyColors.White, LowColor = OxyColors.Black
            });

            var hms = new HeatMapSeries {
                X0 = 1.0, X1 = 2.0, Y0 = 0, Y1 = 20, Data = data, Interpolate = false, RenderMethod = HeatMapRenderMethod.Rectangles, LabelFontSize = 0.4
            };

            model.Series.Add(hms);
            return(model);
        }
        public static PlotModel HeatMapSeries()
        {
            var model = new PlotModel {
                Title = "HeatMapSeries"
            };
            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;
            Func <double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx        = ArrayBuilder.CreateVector(x0, x1, 100);
            var yy        = ArrayBuilder.CreateVector(y0, y1, 100);
            var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            var hms = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            model.Series.Add(hms);

            return(model);
        }
Exemplo n.º 5
0
        public static PlotModel Diagonal_6X6()
        {
            var data = new double[6, 6];

            data[0, 0] = 1;
            data[1, 1] = 1;
            data[2, 2] = 1;
            data[3, 3] = 1;
            data[4, 4] = 1;
            data[5, 5] = 1;

            var model = new PlotModel {
                Title = "Diagonal 6×6"
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            // note: the coordinates are specifying the centers of the edge cells
            var hms = new HeatMapSeries {
                X0 = 0, X1 = 5, Y0 = 5, Y1 = 0, Data = data, Interpolate = false
            };

            model.Series.Add(hms);
            return(model);
        }
        public void UpdateMap(string field, double[,] values, double x0, double x1, double y0, double y1)
        {
            PlotModelPP.Title = field;

            heatMapSeries             = new HeatMapSeries();
            heatMapSeries.Interpolate = true;
            heatMapSeries.Data        = values;
            heatMapSeries.X0          = x0;
            heatMapSeries.X1          = x1;
            heatMapSeries.Y0          = y0;
            heatMapSeries.Y1          = y1;
            PlotModelPP.Series.Clear();
            PlotModelPP.Series.Add(heatMapSeries);

            PlotModelPP.Axes.Clear();

            var linearColorAxis = new LinearColorAxis();

            linearColorAxis.HighColor = OxyColors.Gray;
            linearColorAxis.LowColor  = OxyColors.Black;
            linearColorAxis.Position  = AxisPosition.Right;
            PlotModelPP.Axes.Add(linearColorAxis);

            linearAxisX          = new LinearAxis();
            linearAxisX.Position = AxisPosition.Bottom;
            linearAxisX.Minimum  = x0;
            linearAxisX.Maximum  = x1;
            PlotModelPP.Axes.Add(linearAxisX);

            linearAxisY          = new LinearAxis();
            linearAxisY.Position = AxisPosition.Left;
            linearAxisY.Minimum  = y0;
            linearAxisY.Maximum  = y1;
            PlotModelPP.Axes.Add(linearAxisY);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates a simple example heat map from a 2×3 matrix.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="interpolate">Interpolate the HeatMapSeries if set to <c>true</c>.</param>
        /// <returns>A <see cref="PlotModel" />.</returns>
        private static PlotModel CreateExample(string title, bool interpolate)
        {
            var data = new double[2, 3];

            data[0, 0] = 0;
            data[0, 1] = 0.2;
            data[0, 2] = 0.4;
            data[1, 0] = 0.1;
            data[1, 1] = 0.3;
            data[1, 2] = 0.2;

            var model = new PlotModel {
                Title = "HeatMapSeries", Subtitle = title
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            // adding half cellwidth/cellheight to bounding box coordinates
            var hms = new HeatMapSeries
            {
                CoordinateDefinition = HeatMapCoordinateDefinition.Center,
                X0            = 0.5,
                X1            = 1.5,
                Y0            = 0.5,
                Y1            = 2.5,
                Data          = data,
                Interpolate   = interpolate,
                LabelFontSize = 0.2
            };

            model.Series.Add(hms);
            return(model);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Adds a peaks HeatMapSeries to the plot model.
        /// </summary>
        /// <param name="pm">The plot model.</param>
        public void AddPeaks(PlotModel pm)
        {
            double x0        = -3.1;
            double x1        = 3.1;
            double y0        = -3;
            double y1        = 3;
            var    xx        = ArrayHelper.CreateVector(x0, x1, 100);
            var    yy        = ArrayHelper.CreateVector(y0, y1, 100);
            var    peaksData = ArrayHelper.Evaluate(Functions.Peaks, xx, yy);

            pm.Axes.Add(
                new LinearColorAxis
            {
                Position      = AxisPosition.Right,
                Palette       = OxyPalettes.Jet(500),
                HighColor     = OxyColors.Gray,
                LowColor      = OxyColors.Black,
                IsAxisVisible = false
            });

            var hms = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            pm.Series.Add(hms);
        }
        private void InitChart()
        {
            _heatMapModel = new PlotModel
            {
                Title = "Weights"
            };

            _heatMapModel.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Gray(256),
            });

            _headmapData   = new double[15, 15];
            _heatMapSeries = new HeatMapSeries
            {
                X0          = 0,
                X1          = 9,
                Y0          = 0,
                Y1          = 9,
                Interpolate = false,
                Data        = _headmapData
            };

            _heatMapModel.Series.Add(_heatMapSeries);
            heatMap.Model = _heatMapModel;
        }
        public override void OnAppearing(object navigationContext)
        {
            base.OnAppearing(navigationContext);

            PlotModel = new PlotModel
            {
                Title = "HeatMap"
            };

            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;

            Func <double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx        = ArrayBuilder.CreateVector(x0, x1, 100);
            var yy        = ArrayBuilder.CreateVector(y0, y1, 100);
            var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);

            PlotModel.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black
            });

            var heatMapSerie = new HeatMapSeries {
                X0 = x0, X1 = x1, Y0 = y0, Y1 = y1, Data = peaksData
            };

            PlotModel.Series.Add(heatMapSerie);
        }
Exemplo n.º 11
0
        public void InitializeSscan()
        {
            InitSscanModel();

            plotSscanModel = new PlotModel
            {
                Title = "Sscan plotting",
            };

            var axis = new LinearColorAxis
            {
                Position      = AxisPosition.Right,
                StartPosition = 0,
                EndPosition   = 1,
            };

            plotSscanModel.Axes.Add(axis);

            heatmapSeries = new HeatMapSeries
            {
                X0           = sscanModel.XAxis.Min,
                X1           = sscanModel.XAxis.Max,
                Y1           = sscanModel.YAxis.Min,
                Y0           = sscanModel.YAxis.Max,
                Interpolate  = true,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = plottingData,
            };
            plotSscanModel.Series.Add(heatmapSeries);
        }
Exemplo n.º 12
0
        public static PlotModel HeatMapSeriesInterpolationColor()
        {
            var data = new double[2, 3];

            data[0, 0] = 10;
            data[0, 1] = 0;
            data[0, 2] = -10;

            var model = new PlotModel {
                Title = "HeatMapSeries"
            };

            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = new OxyPalette(OxyColors.Red, OxyColors.Green, OxyColors.Blue)
            });

            var hms = new HeatMapSeries
            {
                CoordinateDefinition = HeatMapCoordinateDefinition.Center,
                X0            = 0,
                X1            = 3,
                Y0            = 0,
                Y1            = 2,
                Data          = data,
                Interpolate   = false,
                LabelFontSize = 0.2
            };

            model.Series.Add(hms);
            return(model);
        }
Exemplo n.º 13
0
        void Seat_1_Update() //座墊-熱點計算更新
        {
            this.Seat_1 = new PlotModel {
                Title = ""
            };

            Seat_1.PlotAreaBorderColor = OxyColors.Transparent;

            Seat_1.Axes.Add(new OxyPlot.Axes.LinearColorAxis
            {
                Palette = OxyPalettes.Rainbow(500)
            });

            Seat_1.Axes.Add(new LinearAxis()
            {
                Position      = AxisPosition.Bottom,
                IsAxisVisible = false
            });

            Seat_1.Axes.Add(new LinearAxis()
            {
                Position      = AxisPosition.Left,
                IsAxisVisible = false
            });

            #region  顏色距陣計算
            // generate 1d normal distribution

            var    singleDataSeat_1 = new double[100];
            Random rndSeat_1        = new Random();

            for (int x = 0; x < 100; ++x)
            {
                singleDataSeat_1[x] = Math.Exp((-1.0 / 2.0) * Math.Pow(((double)x - 50.0) / Convert.ToDouble(rndSeat_1.Next(900, 1200)), 2.0));
            }

            // generate 2d normal distribution
            for (int x = 0; x < 100; ++x)
            {
                for (int y = 0; y < 100; ++y)
                {
                    data_Seat_1[y, x] = singleDataSeat_1[x] * singleDataSeat_1[(y + 30) % 100] * 100;
                }
            }

            #endregion

            var heatMapSeat_1_Series = new HeatMapSeries
            {
                X0           = 0,
                X1           = 99,
                Y0           = 0,
                Y1           = 99,
                Interpolate  = true,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = data_Seat_1
            };

            this.Seat_1.Series.Add(heatMapSeat_1_Series);
        }
Exemplo n.º 14
0
        private void FillSpectogram(PlotView view, double[,] data)
        {
            var model = new PlotModel {
            };

            model.Axes.Add(new LinearColorAxis {
            });

            model.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Left,
                Title    = "Frequency (Hz)",
            });

            model.Axes.Add(new LinearAxis
            {
                Position = AxisPosition.Bottom,
                Title    = "Time (s)",
            });

            var series = new HeatMapSeries
            {
                X0           = 0,
                X1           = length.TotalSeconds,
                Y0           = 0,
                Y1           = sampleRate / 2,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Interpolate  = true,
                Data         = data
            };

            model.Series.Add(series);
            view.Model = model;
        }
Exemplo n.º 15
0
        private void InitChart()
        {
            Resolution = 50;

            _heatMapModel = new PlotModel {
                Title = "Output"
            };

            _heatMapModel.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Gray(256),
            });

            _headmapData   = new double[Resolution, Resolution];
            _heatMapSeries = new HeatMapSeries
            {
                X0           = 0,
                X1           = 1,
                Y0           = 0,
                Y1           = 1,
                Interpolate  = false,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = _headmapData
            };

            _heatMapModel.Series.Add(_heatMapSeries);
            heatMap.Model = _heatMapModel;
        }
Exemplo n.º 16
0
        protected override void BeginProcessing()
        {
            var bp    = MyInvocation.BoundParameters;
            var style = TypeAdaptors.Style.ConvertFrom(Style);

            var si     = new SeriesInfo <HeatMapSeries>();
            var series = new HeatMapSeries();

            style.ApplyStyleTo(series);

            AssignParameters(series, bp);

            si.Series = new [] { series };

            if (!bp.ContainsKey("X0") && !bp.ContainsKey("X1"))
            {
                series.X0 = 0.0;
                series.X1 = 1.0;
            }

            if (!bp.ContainsKey("Y0") && !bp.ContainsKey("Y1"))
            {
                series.Y0 = 1.0;
                series.Y1 = 0.0;
            }

            PostProcess(AddTo, new[] { si }, OutFile, OutWidth, OutHeight, SvgIsDocument, PassThru, style, AsPlotView, Show, ReuseWindow);
        }
        public PlotModel MagnifierColorImage(Image <Bgr, byte> colorImage)
        {
            CreateAxisForPlot();

            plotImage.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Rainbow(255 * 255 * 255)
            });

            var dataGreen = GenerateColorPixel(colorImage, 1);
            var dataRed   = GenerateColorPixel(colorImage, 2);
            var dataBlue  = GenerateColorPixel(colorImage, 0);

            var heatMapSeriesBlue = new HeatMapSeries
            {
                X0            = 0,
                X1            = 8,
                Y0            = 0,
                Y1            = 8,
                XAxisKey      = "xAxis",
                YAxisKey      = "yAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2,
                Interpolate   = true,
                Data          = dataBlue
            };
            var heatMapSeriesGreen = new HeatMapSeries
            {
                X0            = 0,
                X1            = 8,
                Y0            = 0,
                Y1            = 8,
                XAxisKey      = "xAxis",
                YAxisKey      = "yAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2,
                Interpolate   = true,
                Data          = dataGreen
            };
            var heatMapSeriesRed = new HeatMapSeries
            {
                X0            = 0,
                X1            = 8,
                Y0            = 0,
                Y1            = 8,
                XAxisKey      = "xAxis",
                YAxisKey      = "yAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2,
                Interpolate   = true,
                Data          = dataRed
            };

            plotImage.Series.Add(heatMapSeriesBlue);
            plotImage.Series.Add(heatMapSeriesGreen);
            plotImage.Series.Add(heatMapSeriesRed);

            return(plotImage);
        }
Exemplo n.º 18
0
        //public PlotModel display_heatMap()
        //{
        //    var model = new PlotModel();
        //    model.Title = "Cos Similarity";
        //    var linearAxis1 = new LinearAxis();
        //    linearAxis1.Position = AxisPosition.Bottom;
        //    model.Axes.Add(linearAxis1);
        //    var linearAxis2 = new LinearAxis();
        //    model.Axes.Add(linearAxis2);
        //    return model;
        //}
        public PlotModel display_heatMap()
        {
            var model = new PlotModel();

            model.Title = "Cos Similarity";
            var linearColorAxis1 = new LinearColorAxis();

            linearColorAxis1.HighColor = OxyColors.Gray;
            linearColorAxis1.LowColor  = OxyColors.Black;
            linearColorAxis1.Position  = AxisPosition.Right;
            model.Axes.Add(linearColorAxis1);
            var linearAxis1 = new LinearAxis();

            linearAxis1.Position = AxisPosition.Bottom;
            linearAxis1.Minimum  = Min;
            linearAxis1.Maximum  = Max;
            model.Axes.Add(linearAxis1);
            var linearAxis2 = new LinearAxis();

            linearAxis2.Minimum = Min;
            linearAxis2.Maximum = Max;
            model.Axes.Add(linearAxis2);
            var heatMapSeries1 = new HeatMapSeries();

            heatMapSeries1.X0          = 0;
            heatMapSeries1.X1          = 1.0;
            heatMapSeries1.Y0          = 0;
            heatMapSeries1.Y1          = 1.0;
            heatMapSeries1.Interpolate = false;
            heatMapSeries1.Data        = new Double[Scores.Count, Scores.Count];
            for (int i = 0; i < Scores.Count; ++i)
            {
                for (int j = 0; j < Scores.Count; ++j)
                {
                    heatMapSeries1.Data[i, j] = Scores[i][j];
                }
            }
            model.Series.Add(heatMapSeries1);
            heatMapSeries1.MouseDown += (s, e) =>
            {
                DataPoint point   = model.Axes[1].InverseTransform(e.Position.X, e.Position.Y, model.Axes[2]);
                int       x_index = (int)((point.X - this.Min) / this.Width);
                int       y_index = (int)((point.Y - this.Min) / this.Width);
                if (x_index < 0 || x_index >= Ncs.Count || y_index < 0 || y_index >= Ncs.Count)
                {
                    return;
                }
                string       title1     = Ncs[x_index].get_title();
                string       title2     = Ncs[y_index].get_title();
                int          psm1_index = (int)Psm_hash[title1];
                int          psm2_index = (int)Psm_hash[title2];
                PSM          psm1       = MainW.psms[psm1_index];
                PSM          psm2       = MainW.psms[psm2_index];
                PlotModel    model0     = display_TwoMS2(psm1, psm2);
                Model_Window mw         = new Model_Window(model0, psm2.Title + "-" + psm1.Title);
                mw.Show();
            };
            return(model);
        }
Exemplo n.º 19
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;
        }
Exemplo n.º 20
0
        private void krigingWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var surface2D = e.Argument as Surface2D;

            if (surface2D == null)
            {
                e.Cancel = true;
                return;
            }

            var inputPoints = Matrix <float> .Build.DenseOfColumnArrays(surface2D.XValues, surface2D.YValues);

            var valueVector = Vector <float> .Build.DenseOfArray(surface2D.ZValues);

            var vgram = new Powvargram(inputPoints, valueVector);
            var krig  = new Kriging(inputPoints, valueVector, vgram);

            var xmin = surface2D.XValues.Min();
            var ymin = surface2D.YValues.Min();

            // Create the heatmap series
            var surfMap = new HeatMapSeries
            {
                X0                   = surface2D.XValues.Min(),
                X1                   = surface2D.XValues.Max(),
                Y0                   = surface2D.YValues.Min(),
                Y1                   = surface2D.YValues.Max(),
                Data                 = new double[surface2D.Nx, surface2D.Ny],
                Interpolate          = false,
                CoordinateDefinition = HeatMapCoordinateDefinition.Edge
            };

            var progress = 0;

            for (var i = 0; i < surface2D.Ny; i++)
            {
                for (var j = 0; j < surface2D.Nx; j++)
                {
                    progress++;
                    krigingWorker.ReportProgress((progress * 100) / (surface2D.Nx * surface2D.Ny));
                    var point2Interpolate =
                        Vector <float> .Build.DenseOfArray(new[] { xmin + (j * surface2D.Dx), ymin + (i * surface2D.Dy) });

                    surfMap.Data[j, i] = krig.Interpolate(point2Interpolate);
                }
            }

            var result = new Tuple <HeatMapSeries, Surface2D>(surfMap, surface2D);

            e.Result = result;
        }
Exemplo n.º 21
0
        public MainViewModel()
        {
            this.MyModel = new PlotModel {
                Title = "ContourSeries"
            };

            this.MyModel.Axes.Add(new LinearColorAxis
            {
                Position = OxyPlot.Axes.AxisPosition.Right,
                //Palette = OxyPalettes.Jet(500)
                Palette = OxyPalettes.Rainbow(100)
            });

            double x0 = -3.1;
            double x1 = 3.1;
            double y0 = -3;
            double y1 = 3;

            //generate values
            Func <double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
            var xx        = ArrayBuilder.CreateVector(x0, x1, 100);
            var yy        = ArrayBuilder.CreateVector(y0, y1, 100);
            var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);


            var heatMapSeries = new HeatMapSeries
            {
                X0           = x0,
                X1           = x1,
                Y0           = y0,
                Y1           = y1,
                Interpolate  = true,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = peaksData
            };

            this.MyModel.Series.Add(heatMapSeries);


            var cs = new ContourSeries
            {
                Color             = OxyColors.Black,
                LabelBackground   = OxyColors.Transparent,
                ColumnCoordinates = yy,
                RowCoordinates    = xx,
                Data = peaksData
            };

            this.MyModel.Series.Add(cs);
        }
Exemplo n.º 22
0
        protected override void UpdateSeries()
        {
            var model = _model.Model;

            model.Series.Clear();

            for (var i = 0; i < _plot.Count; i++)
            {
                var points = _plot[i];
                var series = new HeatMapSeries();
                UpdateSeries(series, points);
                model.Series.Add(series);
            }
        }
Exemplo n.º 23
0
        public void Initialize()
        {
            var plotModel = new PlotModel
            {
                Subtitle = $"Semanantic Link: {_parentViewModel.SemanticLink.SemanticLinkId}, Direction: {_parentViewModel.Direction.Direction}"
            };

            var colorAxis = new LinearColorAxis
            {
                HighColor = OxyColors.Gray,
                LowColor  = OxyColors.Black,
                Position  = AxisPosition.Right
            };

            plotModel.Axes.Add(colorAxis);

            var xAxis = new LinearAxis
            {
                Title    = "Time",
                Unit     = "s",
                Position = AxisPosition.Bottom
            };

            plotModel.Axes.Add(xAxis);

            var yAxis = new LinearAxis
            {
                Title = "Lost Energy",
                Unit  = "kWh"
            };

            plotModel.Axes.Add(yAxis);

            var heatMapSeries1 = new HeatMapSeries
            {
                LabelFormatString = "0",
                X0            = _parentViewModel.ChoraleModel.MinTransitTime,
                X1            = _parentViewModel.ChoraleModel.MaxTransitTime,
                Y0            = _parentViewModel.ChoraleModel.MinLostEnegry,
                Y1            = _parentViewModel.ChoraleModel.MaxLostEnergy,
                LabelFontSize = 0.2,
                Data          = _parentViewModel.ChoraleModel.Data
            };

            plotModel.Series.Add(heatMapSeries1);

            PlotModel = plotModel;
            _parentViewModel.ProgressBarVisibility = System.Windows.Visibility.Collapsed;
        }
Exemplo n.º 24
0
        public ChartPlot(HeatMapSeries map, Surface2D surf)
        {
            InitializeComponent();
            plotView1.Model = Surf2DModel(surf);
            plotView1.Model.Series.Add(map);

            switch (surf.SurfType)
            {
            case Surface2D.SurfaceType.Pseudosections:
                Text = $"Pseudosections [{surf.Title}]";
                break;

            case Surface2D.SurfaceType.Surface:
                Text = $"2D Surface [{surf.Title}]";
                break;
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Plot the given data.
        /// </summary>
        /// <param name="data">Data to plot by creating a series.</param>
        private void PlotProfileData(double[,] data)
        {
            // Update the plots in the dispatcher thread
            try
            {
                // Lock the plot for an update
                lock (Plot.SyncRoot)
                {
                    // Clear any current series
                    StatusMsg = "Clear old Plot";
                    Plot.Series.Clear();

                    // Create a heatmap series
                    HeatMapSeries series = new HeatMapSeries();
                    series.X0          = 0;                 // Left starts 0
                    series.X1          = data.GetLength(0); // Right (num ensembles)
                    series.Y0          = 0;                 // Top starts 0
                    series.Y1          = data.GetLength(1); // Bottom end (num bins)
                    series.Data        = data;
                    series.Interpolate = false;

                    // Add the series to the plot
                    StatusMsg = "Add Plot data";
                    Plot.Series.Add(series);
                }
            }
            catch (Exception ex)
            {
                // When shutting down, can get a null reference
                Debug.WriteLine("Error updating Heatmap Plot", ex);
            }

            // After the line series have been updated
            // Refresh the plot with the latest data.
            StatusMsg = "Drawing Plot";
            Plot.InvalidatePlot(true);

            if (data != null)
            {
                StatusMsg = "Drawing complete.  Total Ensembles: " + data.GetLength(0);
            }
            else
            {
                StatusMsg = "Drawing complete.";
            }
        }
Exemplo n.º 26
0
        Task RenderHeatMap(Series plot)
        {
            var heatMapSeries = new HeatMapSeries
            {
                Data         = plot.Config.Data,
                X0           = plot.Config.X0,
                X1           = plot.Config.X1,
                Y0           = plot.Config.Y0,
                Y1           = plot.Config.Y1,
                Interpolate  = plot.Config.Interpolate,
                RenderMethod = plot.Config.RenderMethod
            };

            OxyplotModel.Series.Add(heatMapSeries);

            return(Task.CompletedTask);
        }
        public static PlotModel LinearHeatMap()
        {
            var model = new PlotModel {
                Title = "Heatmap"
            };

            // Color axis (the X and Y axes are generated automatically)
            model.Axes.Add(new LinearColorAxis
            {
                Palette = OxyPalettes.Rainbow(100)
            });

            // generate 1d normal distribution
            var singleData = new double[100];

            for (int x = 0; x < 100; ++x)
            {
                singleData[x] = Math.Exp((-1.0 / 2.0) * Math.Pow(((double)x - 50.0) / 20.0, 2.0));
            }

            // generate 2d normal distribution
            var data = new double[100, 100];

            for (int x = 0; x < 100; ++x)
            {
                for (int y = 0; y < 100; ++y)
                {
                    data[y, x] = singleData[x] * singleData[(y + 30) % 100] * 100;
                }
            }

            var heatMapSeries = new HeatMapSeries
            {
                X0           = 0,
                X1           = 99,
                Y0           = 0,
                Y1           = 99,
                Interpolate  = true,
                RenderMethod = HeatMapRenderMethod.Bitmap,
                Data         = data
            };

            model.Series.Add(heatMapSeries);

            return(model);
        }
Exemplo n.º 28
0
        private PlotModel CreateModel(string[] featureNameArray, double[,] correlationMatrixData)
        {
            var model = new PlotModel {
                Title = "Correlation Matrix of Features"
            };

            model.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Bottom,
                Key         = "BottomFeatureAxis",
                ItemsSource = featureNameArray,
                Angle       = -45,
                //FontSize = 20
            });
            model.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Left,
                Key         = "LeftFeatureAxis",
                ItemsSource = featureNameArray,
                //FontSize = 20
            });
            model.Axes.Add(new LinearColorAxis
            {
                Minimum = -1,
                Maximum = 1,
                //Palette = OxyPalettes.BlueWhiteRed(200)
                Palette = OxyPalettes.BlueWhiteRed(200)
//                Palette = OxyPalettes.Hot(200)
            });
            var heatMapSeries = new HeatMapSeries
            {
                X0            = 0,
                X1            = featureNameArray.Length,
                Y0            = 0,
                Y1            = featureNameArray.Length,
                XAxisKey      = "BottomFeatureAxis",
                YAxisKey      = "LeftFeatureAxis",
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.3, // neccessary to display the
                Data          = correlationMatrixData
            };

            model.Series.Add(heatMapSeries);
            return(model);
        }
Exemplo n.º 29
0
        private void Plot_Load(object sender, EventArgs e)
        {
            //Create Plotview object
            PlotView myPlot = new PlotView();

            var model = new PlotModel {
                Title = "GRID"
            };


            // Color axis


            model.Axes.Add(new LinearColorAxis {
                Position = AxisPosition.Right, Palette = OxyPalettes.Jet(1200), Maximum = ambientT, Minimum = 100
            });


            var heatMapSeries = new HeatMapSeries
            {
                X0            = 0,
                X1            = 16,
                Y0            = 0,
                Y1            = 16,
                Interpolate   = true,
                RenderMethod  = HeatMapRenderMethod.Rectangles,
                LabelFontSize = 0.2, // neccessary to display the label
                Data          = data,
            };

            model.Series.Add(heatMapSeries);

            //Assign PlotModel to PlotView
            myPlot.Model = model;

            //Set up plot for display
            //myPlot.Dock = System.Windows.Forms.DockStyle.Bottom;
            myPlot.Dock     = System.Windows.Forms.DockStyle.Fill;
            myPlot.Location = new System.Drawing.Point(0, 0);
            myPlot.Size     = new System.Drawing.Size(500, 500);
            myPlot.TabIndex = 0;

            //Add plot control to form
            Controls.Add(myPlot);
        }
Exemplo n.º 30
0
        void UpdateSeries(HeatMapSeries series, Points <HeatmapPlotValue.HeatPoint> points)
        {
            series.Title       = points.Label;
            series.Interpolate = _plot.IsInterpolated;
            series.X0          = _plot.MinX;
            series.X1          = _plot.MaxX;
            series.Y0          = _plot.MinY;
            series.Y1          = _plot.MaxY;
            var cols = (Int32)_plot.MaxX;
            var rows = (Int32)_plot.MaxY;
            var data = new Double[cols, rows];

            foreach (var point in points)
            {
                data[point.Column - 1, point.Row - 1] = point.Magnitude;
            }

            series.Data = data;
        }