Heatmap / 2dHistogramContour using averages, how to make areas with missing data transparent?


I am making a contour plot using average values. I would like it to only show the areas where there is existing data, and the rest should be transparent.

This is an example of a plot I am making:


I have gotten around this problem by setting the very first value on the colorscale to be transparent, like so:

colorscale = [(0.0, 'rgba(255,255,255,0)'),
              (0.0001, 'rgb(247,251,255)'),
              (0.125, 'rgb(222,235,247)'),

But that doesn’t work when I use other columns than β€˜height’ for the z value because they contain a lot of 0’s, which then average some areas to 0 and those go transparent even though they are based on existing data.

How can I make it so that only areas with no data are transparent?