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

Plot population on a world map


I tried to make a plot of the world wide population using choropleth maps. Here is a notebook about this :

In the documentation of the data I have dowloaded, they said that LocID is ISO-3 value. Thus I used this for the plot but it does not work. I wonder if the problem comes from here or if there is something else wrong.


Not sure what went wrong, but those LocID items are numbers whereas ISO-3 entries should be three-letter strings.

Looks like your data’s Location field correspond to (mostly) county name, so I’d recommend trying out locationmode: 'country name'.

Thank you etienne.
I did another example with 3 letters strings and it works.
I would like to know if you could advice a geojson tools to read geojson file ?

For example, I would like to plot french departements or regions on a map. I have a geojson file with coordinate of departement. I would like to be able to to a choropleth with this. Is this possible with plotlty and mapbox for example ?


After several research I find this (french) web site and geopandas python library

With geopandas you can easily read shape files which contains polygons corresponding to several division.

Finally, I did this plot :

Is there a way to make the map and the colorbar closer each other ?