List of locationmode to use with plotly

Matheus Sant'ana picture Matheus Sant'ana · Jun 21, 2019 · Viewed 13.5k times · Source

I need to make a graphical representation of data distributed in Brazil, which is my country.

I found that plotly can do this job, but when I went to research how to use plotly, every tutorial was using the locationmode attribute as 'USA-states'.

Is there a list with countries codes, so I can go after to see which is the right way of calling it?

Answer

PythonNoob picture PythonNoob · Jun 22, 2019

From docs: https://plot.ly/python/reference/#scattergeo-locationmode

locationmode ( enumerated : "ISO-3" | "USA-states" | "country names" ) 
default: "ISO-3" 
Determines the set of locations used to match entries in `locations` to regions on the map.

So for Brazil you have to add these lines:

locations = ["Brazil"],
locationmode = 'country names'