Search code examples
c#wpfoxyplot

Is there any way to remove backround on OxyPlot HeatMapSeries?


HeatMapSeries renders all area from X0,Y0 to X1,Y1 by default. Is there any way to avoid rendering points with value double.NaN?

How I want it to be


Solution

  • You should be able to achieve this by setting the ColorAxis.InvalidNumberColor property to OxyColors.Transparent (or another color of your choice), for example when you create the axis:

    PlotModel model = ...;
    model.Axes.Add(new LinearColorAxis { Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), `InvalidNumberColor = OxyColors.Transparent` });
    

    This property defaults to OxyColors.Gray, hence the solid color you are seeing.

    Additional examples in the example library: https://github.com/oxyplot/oxyplot/blob/develop/Source/Examples/ExampleLibrary/Series/HeatMapSeriesExamples.cs#L116