Created
September 18, 2019 14:07
-
-
Save Ayeeta/ed7871bdd0f6aa34bd811b4f297dde29 to your computer and use it in GitHub Desktop.
visualize poverty levels on US 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'] = "Poverty Estimates 2017"+"\ | |
"+ states["POVALL_2017"].astype(str) + " " +"State:" +" \ | |
"+ states["Area_Name"] | |
fig = go.Figure(data=go.Choropleth( | |
locations=states['State'], # Spatial coordinates | |
z = states["POVALL_2017"].astype(float), # Data to be color-coded | |
locationmode = 'USA-states', # set of locations match entries in `locations` | |
colorscale = 'greens', | |
text = states['text'], | |
colorbar_title = "Poverty Estimates 2017", | |
reversescale = True | |
)) | |
fig.update_layout( | |
title_text= "Poverty Estimates 2017", | |
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