Black Lives Matter. Please consider donating to Black Girls Code today.

Density Heatmap - output changes for same point between pannning


First post, so here goes nothing!

Is there a way to set the random seed on the mapbox density heatmap (

The reason I ask is that I notice that when I pan on a heatmap, the density changes. Below are some screenshot examples, the only difference being I panned between screenshots (not zoom). I assume it’s a random seed thing? If not, is there a way to ensure a consistent output?



Turns out when I don’t set the radius then I don’t have this problem!

Hi @r4ch45 welcome to the forum! Unfortunately I can’t reproduce the issue with the documentation examples, even when setting the radius. Any chance that you could share some minimal code and data reproducing the issue? Could you also tell us which version of you are using?

Hi Emmanuelle,

Sure thing - thanks! The documentation example has the same issue for me when the radius is reduced from 10, and you zoom into an area. I’m on version 4.6.0.

import pandas as pd
quakes = pd.read_csv('')

import plotly.graph_objects as go
fig = go.Figure(go.Densitymapbox(lat=quakes.Latitude, lon=quakes.Longitude, z=quakes.Magnitude,
fig.update_layout(mapbox_style="stamen-terrain", mapbox_center_lon=180)



Hum still can’t reproduce (On Firefox). Which browser are you using? Did you try with another browser (you can use the documentation examples with the binder links if you don’t want to set up the notebook with another browser)?

Damn, I’m on Chrome 80.0.3987.163 (on a locked down machine without Firefox annoyingly). Ran a binder from the docs on Chrome with radius=3 for fun and still getting same issue. Same issue on IE but not sure that says much.

wow this is weird because I don’t get the issue on Chrome (with radius=3). It’d be great if someone else here could give it a try and see if they can reproduce the issue.

1 Like

Hi, I’m on the same Chrome version (80.0.3987.163) and can see a similar issue with a radius below 3.

My display settings are 1920 by 1280, at 150% scaling - and it looks like the issue is more visible at 100% scaling.