Created
September 11, 2019 11:55
-
-
Save Ayeeta/dce58079fe10f4f24728e425c7fba46c to your computer and use it in GitHub Desktop.
visualize international migrant destinations on a choropleth map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
states['text'] = "International Migration 2018"+"\ | |
"+ states["INTERNATIONAL_MIG_2018"].astype(str) + " " +"State:" +" \ | |
"+ states["Area_Name"] | |
fig = go.Figure(data=go.Choropleth( | |
locations=states['State'], # Spatial coordinates | |
z = states["INTERNATIONAL_MIG_2018"].astype(float), # Data to be color-coded | |
locationmode = 'USA-states', # set of locations match entries in `locations` | |
colorscale = 'reds', | |
text = states['text'], | |
colorbar_title = "International Migration", | |
)) | |
fig.update_layout( | |
title_text= "International Migration 2018", | |
geo = dict( | |
scope='usa', | |
projection=go.layout.geo.Projection(type = 'albers usa'), | |
showlakes=True, # lakes | |
lakecolor='rgb(255,255,255)'), | |
) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment