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); }
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; }
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; }
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); }
/// <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)); }
public void Discussion453825_100() { var data = new byte[100, 100]; int k = 0; for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { data[i, j] = (byte)(k++ % 256); } } var palette = OxyPalettes.Gray(256).Colors.ToArray(); var im = OxyImage.Create(data, palette, ImageFormat.Bmp); File.WriteAllBytes(@"Imaging\Discussion453825.bmp", im.GetData()); }
private static void GeneratePalette() { int fSourcesCount = SourcesDirector.Instance.ForecastDataSources.Count(); int rSourcesCount = SourcesDirector.Instance.RealDataSources.Count(); colorsBySource = new Dictionary <string, OxyColor>(); OxyPalette palette = OxyPalettes.Jet(fSourcesCount); for (int i = 0; i < fSourcesCount; i++) { colorsBySource.Add(SourcesDirector.Instance.ForecastDataSources.ElementAt(i).Id, palette.Colors[i]); } palette = OxyPalettes.Gray(rSourcesCount + 1); for (int i = 0; i < rSourcesCount; i++) { colorsBySource.Add(SourcesDirector.Instance.RealDataSources.ElementAt(i).Id, palette.Colors[i]); } }
public void PointsPlot_Vectorizing(double[][][] transformation_x, double[][][] transformation_y, int i_s, int selected_index) { OxyPlot.Annotations.ArrowAnnotation[] vector_field = new OxyPlot.Annotations.ArrowAnnotation[numPoints]; plotModel.Annotations.Clear(); for (int i_p = 0; i_p < numPoints; i_p++) { vector_field[i_p] = new OxyPlot.Annotations.ArrowAnnotation(); vector_field[i_p].StartPoint = new DataPoint(plotData[i_p].Points[0].X, plotData[i_p].Points[0].Y); vector_field[i_p].EndPoint = new DataPoint(plotData[i_p].Points[0].X + transformation_x[i_s][i_p][selected_index], plotData[i_p].Points[0].Y + transformation_y[i_s][i_p][selected_index]); vector_field[i_p].HeadLength = 4; vector_field[i_p].HeadWidth = 1; double vector_length = Math.Sqrt(transformation_x[i_s][i_p][selected_index] * transformation_x[i_s][i_p][selected_index] + transformation_y[i_s][i_p][selected_index] * transformation_y[i_s][i_p][selected_index]); vector_field[i_p].Color = OxyPalettes.Gray(100).Colors[99 - (int)Math.Round(vector_length * 99)]; plotData[i_p].MarkerFill = OxyPalettes.Gray(100).Colors[99 - (int)Math.Round(vector_length * 99)]; plotModel.Annotations.Add(vector_field[i_p]); } plotModel.InvalidatePlot(true); }
public void Discussion453825_199() { int w = 199; int h = 256; var data = new byte[h, w]; var data2 = new byte[h * w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { data[i, j] = (byte)(i % 256); data2[(i * w) + j] = (byte)(i % 256); } } var palette1 = OxyPalettes.Gray(256).Colors.ToArray(); var im1 = OxyImage.Create(data, palette1, ImageFormat.Bmp); var bytes1 = im1.GetData(); // The images should show a gradient image 199x256 - black at the bottom, white at the top File.WriteAllBytes(@"Imaging\Discussion453825_199a.bmp", bytes1); }
public void PlotDetector(Detector detector) { var model = new PlotModel(); model.PlotType = PlotType.Cartesian; var sser = new OxyPlot.Series.HeatMapSeries() { X0 = detector.MinDetectorPositionMer, X1 = detector.MaxDetectorPositionMer, Y0 = detector.MinDetectorPositionSag - detector.PixelSize / 2.0, Y1 = detector.MaxDetectorPositionSag + detector.PixelSize / 2.0, Data = detector.GetHeatMap(), Interpolate = false, RenderMethod = HeatMapRenderMethod.Bitmap }; model.Series.Add(sser); model.Axes.Add(new OxyPlot.Axes.LinearAxis { Title = "x, [mm]", Position = AxisPosition.Bottom, Maximum = detector.MaxDetectorPositionMer, Minimum = detector.MinDetectorPositionMer }); model.Axes.Add(new OxyPlot.Axes.LinearAxis { Title = "y, [mm]", Position = AxisPosition.Left, Maximum = detector.MaxDetectorPositionSag, Minimum = detector.MinDetectorPositionSag }); model.Axes.Add(new OxyPlot.Axes.LinearColorAxis { Position = AxisPosition.Right, Palette = OxyPalettes.Gray(1000).Reverse() }); model.Axes[0].AxisChanged += DetectorPlotX_AxisChanged; model.Axes[1].AxisChanged += DetectorPlotY_AxisChanged; m_Canvas.Model = model; m_Canvas.InvalidatePlot(true); }
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)); }
public static PlotModel ColorMapGray32() { return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Gray(32), MarkerType.Diamond, AxisPosition.Right, OxyColors.Undefined, OxyColors.Undefined)); }
public static PlotModel ColorMapGray32() { return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.Gray(32), MarkerType.Diamond)); }