[Python] plotly automatic zooming for "Mapbox maps"

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    In the plotly website Map Configuration and Styling in Python is described how to automatically zoom a "Geo map":

    import plotly.express as px

    fig = px.line_geo(lat=[0,15,20,35], lon=[5,10,25,30]) # Creates a "Geo map" figure
    fig.update_geos(fitbounds="locations") # Automatic Zooming !!!!
    fig.show()


    and this works, moreover if I try to the same on a "Mapbox map" it does not apply auto zoom:

    fig = px.scatter_mapbox(filtered_df, lat="latitude", lon="longitude", color="ID") # Creates a "Mapbox map" figure
    fig.update_layout(mapbox_style="open-street-map")
    fig.update_geos(fitbounds="locations") # Automatic Zooming not working!!!


    There is not information of how to do it in the Mapbox Map Layers in Python.

    Continue reading...

Compartilhe esta Página