I have a WPF application where I need to visualize y = y (x1, x2), where x1, x2 are linear coordinates. I can do this using HeatMapSeries in Oxyplot, but when I want to build two datasets in one window, heatmaps are not a suitable tool. A few contour rows would be better. Now I tried to achieve this in the same way as with HeatMapSeries, which worked very well:
public void PlotHeatMap (){ OxyPlot.PlotModel model = new PlotModel { Title = "2-D data" }; model.Axes.Add( new OxyPlot.Axes.LinearColorAxis { Position = OxyPlot.Axes.AxisPosition.Right, Palette = OxyPalettes.Jet( 500 ), HighColor = OxyColors.Gray, LowColor = OxyColors.Black } ); OxyPlot.Series.HeatMapSeries heatmap = new OxyPlot.Series.HeatMapSeries { Data = ( Double[ , ] )data, X0 = x1min, X1 = x1max, Y0 = x2min, Y1 = x2max }; model.Series.Add( heatmap ); }

Now, when I try to use ContourSeries instead, I just replace HeatMapSeries with ContourSeries:
public void PlotContour (){ OxyPlot.PlotModel model = new PlotModel { Title = "2-D data" }; model.Axes.Add( new OxyPlot.Axes.LinearColorAxis { Position = OxyPlot.Axes.AxisPosition.Right, Palette = OxyPalettes.Jet( 500 ), HighColor = OxyColors.Gray, LowColor = OxyColors.Black } ); OxyPlot.Series.ContourSeries contour = new OxyPlot.Series.ContourSeries { ColumnCoordinates = arrayFromMinToMax1, RowCoordinates = arrayFromMinToMax2, ContourLevels = arrayOfLevels, ContourColors = arrayOfColors, // Same # elements as the levels' array Data = ( Double[ , ] )data }; model.Series.Add( contour ); }
This simply outputs the result:

The x and y axes are and correspond to the min and max coordinates, but I do not see contour lines. I suspect that something is missing when setting up the axis (if it is the same as for HeatMapSeries?). I do not know how to continue this contour plot. Are there examples other than, for example, ContourSeriesExamples examples on GitHub?
Thanks for any help!
c # wpf contour oxyplot
Mats isaksson
source share