I am trying to create a choropleth chart:
import json
import pandas as pd
import plotly.express as px
county={"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {"type": "Polygon",
"coordinates": [[[7.75, 47.1], [7.75, 47.3], [7.25, 47.3], [7.25, 47.1]],
[[9, 47], [9, 47.5], [8, 47.5], [8, 47]],
]},
"id": "01017"
},
]}
d = {'fips': ['01001','01009','01017'], 'unemp': [0, 6,12]}
df = pd.DataFrame(data=d)
fig = px.choropleth_mapbox(df, geojson=county, locations='fips', color='unemp',
color_continuous_scale="Viridis",
range_color=(0, 12),
mapbox_style="carto-positron",
zoom=7, center = {"lat": 47, "lon": 8},
opacity=0.5,
labels={'unemp':'unemployment rate'}
)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
The square on the right hand is not filled and I cannot figure out why.