plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
15.97k stars 2.54k forks source link

plotly px.choropleth doesn't seem to support small Caribbean countries #3388

Closed KangboLu closed 2 years ago

KangboLu commented 2 years ago

I work for the UN and I am a heavy plotly user. I used the 3 letter country code to plot the data for Caribbean regions, but only a few bigger countries with larger land areas are shown in the default px.choropleth map. Another thing is the Bahamas region has less area than it actually has in plotly choropleth. Same for Cuba. One island is missing for Cuba. Cuba won't be happy at all.

I guess I should build my own GeoJSON dataset and plot with GeoJSON instead of using the default px.choropleth map layer? Is plotly going to add more details in the future for choropleth? At least make the existing shown countries complete?

The red circled regions are missing on plotly express choropleth map.

You can also verify it in the documentation example. If you zoom in to the Caribbean region, you will see those countries missing. https://plotly.com/python/choropleth-maps/

Plotly express image

Caribbean map in Google map image image

Bahamas in plotly vs Bahamas in Google map and GeoJSON: image image image

Cuba in plotly vs Cuba in Google map and GeoJSON image image image

nicolaskruchten commented 2 years ago

Yes, we ship two base maps of different resolutions and we default to the coarser one: https://plotly.com/python/map-configuration/#physical-base-maps

There will always be limits to the resolution of the polygons we ship with, and if you need arbitrarily-high resolutions, you'll need to provide your own polygons: https://plotly.com/python/choropleth-maps/#choropleth-map-using-geojson

KangboLu commented 2 years ago

@nicolaskruchten I see. Thanks for the info. I will create my own GeoJSON file to have a finer resolution.

nicolaskruchten commented 2 years ago

Sounds good. For UN-related use-cases I would definitely recommend making very deliberate choices for maps. For example, please do not rely on our defaults for disputed areas like Crimea, Western Sahara etc!