Skip to content

Commit

Permalink
Update geopandas example to support versions >=1.0 (fixes issue plotl…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak Khanna committed Oct 7, 2024
1 parent 7181c4d commit b509b4a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions doc/python/scatter-plots-on-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ fig.show()
import plotly.express as px
import geopandas as gpd

geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
if gpd.__version__ < '1.0':
geo_df = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
else:
import geodatasets
geo_df = gpd.read_file(geodatasets.get_path('naturalearth_cities'))

px.set_mapbox_access_token(open(".mapbox_token").read())
fig = px.scatter_geo(geo_df,
lat=geo_df.geometry.y,
lon=geo_df.geometry.x,
hover_name="name")
lat=geo_df.geometry.y,
lon=geo_df.geometry.x,
hover_name="name")
fig.show()
```

Expand Down

0 comments on commit b509b4a

Please sign in to comment.