pythonplotlychoropleth

List of locationmode to use with plotly


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?


Solution

  • 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'