Hello, Plotliers
Plotly newbie’s here. Is it possible to create ‘choropleth mapbox’ using state abbreviations or should I convert state abbs to fips first?
Thank you so much.
Here is the dataset example.
Here is what I have done using plotly express
import plotly
import plotly.express as px
from urllib.request import urlopen
import json
with urlopen('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json') as response:
counties = json.load(response)
fig = px.choropleth_mapbox(df, geojson=counties, locations='state', color='n',
color_continuous_scale="Viridis",
mapbox_style="carto-positron",
zoom=3, center = {"lat": 37.0902, "lon": -95.7129},
opacity=0.5,
labels={'unemp':'unemployment rate'}
)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
Here is the output of my code
Here is what I am trying to create