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

Auto zoom on mapbox

Hi,

Is it possible to do some auto zoom on the map?

When I plot some markers on different coordinates, it would be nice to have an automatic zoom that just put the view exactly at the coordinates.

1 Like

I would wish to see a similar implementation, where the keyword-argument “zoom” related to mapbox-plots had an auto-zoom-like feature which zooms directly to the extent of the given coordinates.
The problem so far is that I have to run the code a lot of times with a distinct value of the zoom level until the resulting figure is zoomed sufficiently and just right towards the provided coordinate points.

Example:

fig = go.Figure()
trace = go.Densitymapbox(
    lon=x,
    lat=y,
    z=z,
...
fig.update_layout(
    .
..,
    mapbox=dict(...,
        zoom=17))

this indeed would be great, we have an issue open here: https://github.com/plotly/plotly.js/issues/3434

for workarounds, see Dynamic Zoom for mapbox

would love for an organization out there to help funs the development of an enhancement like this: https://plotly.com/products/consulting-and-oem

2 Likes