public void PointsPlot_Coloring(double[] wave_vector) { int max = 100; plotModel.Annotations.Clear(); for (int i_p = 0; i_p < numPoints; i_p++) { int field_value = (int)Math.Round(wave_vector[i_p] / 10); plotData[i_p].LabelFormatString = field_value.ToString(); if (field_value > (max / 2 - 1)) { plotData[i_p].MarkerFill = OxyPalettes.BlueWhiteRed(max).Colors[max - 1]; } else if (field_value < -(max / 2)) { plotData[i_p].MarkerFill = OxyPalettes.BlueWhiteRed(max).Colors[0]; } else { plotData[i_p].MarkerFill = OxyPalettes.BlueWhiteRed(max).Colors[max / 2 + field_value]; } } plotModel.InvalidatePlot(true); }
/// <summary> /// Renders the icon on the specified render context. /// </summary> /// <param name="rc">The render context.</param> /// <param name="size">The size.</param> public override void Render(IRenderContext rc, double size) { var n = (int)size * 2; var data = ArrayHelper.Evaluate(Functions.Peaks, ArrayHelper.CreateVector(-3.1, 2.6, n), ArrayHelper.CreateVector(3.0, -3.4, n)); var palette = OxyPalettes.BlueWhiteRed(5); var min = data.Min2D(); var max = data.Max2D(); var pixels = new OxyColor[n, n]; for (int x = 0; x < n; x++) { for (int y = 0; y < n; y++) { var i = (int)((data[x, y] - min) / (max - min) * palette.Colors.Count); i = Math.Min(Math.Max(i, 0), palette.Colors.Count - 1); pixels[y, n - 1 - x] = palette.Colors[i]; } } var image = OxyImage.Create(pixels, OxyPlot.ImageFormat.Png); rc.DrawImage(image, 0, 0, n, n, 0, 0, size, size, 1, true); var frameWidth = (int)Math.Max(Math.Round(size / 32), 1); rc.DrawRectangle(new OxyRect(0, 0, size, frameWidth), OxyColors.Black, OxyColors.Black, 0); rc.DrawRectangle(new OxyRect(0, size - frameWidth, size, frameWidth), OxyColors.Black, OxyColors.Undefined, 0); rc.DrawRectangle(new OxyRect(0, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0); rc.DrawRectangle(new OxyRect(size - frameWidth, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0); }
public void PointsPlot_Coloring(double[][][] transformation, int i_s, int selected_index) { plotModel.Annotations.Clear(); for (int i_p = 0; i_p < numPoints; i_p++) { plotData[i_p].MarkerFill = OxyPalettes.BlueWhiteRed(200).Colors[100 + (int)Math.Round(transformation[i_s][i_p][selected_index] * 99)]; plotData[i_p].LabelFormatString = Math.Round(transformation[i_s][i_p][selected_index] * 100).ToString(); } plotModel.InvalidatePlot(true); }
/// <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)); }
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); }
public static PlotModel BlueWhiteRed40() { return(HeatMapSeriesExamples.CreatePeaks(OxyPalettes.BlueWhiteRed(40), false)); }
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 ColorMapBlueWhiteRed256() { return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.BlueWhiteRed(256), MarkerType.Square, AxisPosition.Right, OxyColors.Undefined, OxyColors.Undefined)); }
public static PlotModel ColorMapBlueWhiteRed256() { return(CreateRandomScatterSeriesWithColorAxisPlotModel(2500, OxyPalettes.BlueWhiteRed(256))); }