There’s no native way to change the color mapping for NaN values. But, you can easily archive the same result by adding a custom NaN heatmap layer.
In brief, add a trace to your graph with z
matrix consisting of 1
s at the coordinates of the NaNs in your original z
matrix. By defining, a custom trace colorscale
, you can then assign a color to the NaNs values in your data.
See graph: https://plot.ly/~etpinard/7415/heatmap-with-custom-nan-layer.embed
and python code: https://plot.ly/~etpinard/7415/heatmap-with-custom-nan-layer.py