plotly locationmode for the whole world

I am trying to create a choropleth map for some data of the whole world and I am using plotly to do it but found that locationmode examples are all on Usa-States

Is there a way for me to use it on the world

>Solution :

Based on the plotly documentation.
Givent that you have a DataFrame of lats ond lons:

import plotly.graph_objects as go
fig = go.Figure(data=go.Scattergeo(
        lon = df['lon'],
        lat = df['lat'],
        mode = 'markers',
        ))

fig.update_layout(
        title = 'world map with markers',
        geo_scope='world',
    )
fig.show()

Leave a Reply