Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

Mapbox density heatmap: color while zooming

Hi all,

I’m just playing with the mapbox density heatmap example here. When I zoom in to a certain point, the display behaves as expected.

If you zoom out from that point, the value in the tooltip is correct, but in my opinion the color is not displayed correctly or the scaling of the colorbar is wrong.

(Sorry, I didn’t exactly hit the location again, but I think you understand what I mean.)

It seems that there are quakes with the scale of 9 in Wellington (New Zealand).

Am I wrong?

Best regards


I have not looked intro the code, but isn’t that just part of the way heat map visualizations are rendered? I you would like something more consistent in terms of values vs colors on the map, I would use a raster overlay instead (potentially without interpolation, if you need 1:1 mapping with the underlying data).

Hello Pio,

I had the same impression at first but it’s indeed really a matter of

  • extrapolation from the center to the edge of an area around given point, linked to the ‘radius’
  • aggregation when 2 areas overlap, linked to the level of zoom and distance between points (and radius).

When 2 areas overlap, magnitudes of the heatmap (‘z’) seem to be summed (I haven’t checked the exact aggregation method), which could give an erroneous impression while zooming out (because with the set ‘radius’, areas around many points could overlap).

A way to mitigate this issue is to play on the ‘radius’ and on the ‘z’ for each point. Not completely convenient, as the best would be to define the aggregation method (taking the max of overlapping areas could be better in some use cases).

Even though it’s a bit late, I hope it helps.

Best regards,