Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 235
Matheus Sant'ana Avatar asked Jun 21 '19 20:06

Matheus Sant'ana


People also ask

What is Locationmode in Plotly?

locationmode (str) – One of 'ISO-3', 'USA-states', or 'country names' Determines the set of locations used to match entries in locations to regions on the map.

What is Plotly Geo?

Plotly Geo maps have a built-in base map layer composed of "physical" and "cultural" (i.e. administrative border) data from the Natural Earth Dataset.

What is Choropleth map in Python?

Plotly is a free and open-source graphing library for Python. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials. A Choropleth Map is a map composed of colored polygons.

What is plot ly?

Plotly provides online graphing, analytics, and statistics tools for individuals and collaboration, as well as scientific graphing libraries for Python, R, MATLAB, Perl, Julia, Arduino, and REST.


Video Answer


1 Answers

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'
like image 144
PythonNoob Avatar answered Sep 20 '22 08:09

PythonNoob