I made a plotly express choropleth_mapbox of US zip codes. Can I add a choropleth geometry that is the city boundary?
Below is the code to create a choropleth_mapbox of Zip Codes, but in addition, I want to add another choropleth from a shapefile that is only the boundaries of the city
'''
zip_map_fig = px.choropleth_mapbox(zips, geojson=zip_map_zips, locations='Zip Code',
color='price',
range_color=(1, 5),
featureidkey='properties.Zip Code',
center={'lat':mkt_lat, 'lon':mkt_long},
labels={'price' : 'Price'},
mapbox_style='carto-positron',
color_continuous_scale='blues',
opacity=0.3,
zoom=9,
hover_data=['Zip Code'])
zip_map_fig.update_geos(fitbounds='locations', visible=True)
'''
The map below works well for the Zip Codes, but all I want to do is add another line (an empty shape) that shows the outline of the whole city.
I already have the shapefiles for the Zip Codes and the outline of the city.
I tried incorporating the city limit shapefile into the shapefile that is used to create the choropleth_mapbox, but it has no effect.
I know how to add a scattermapbox, but I just want to add another choropleth.
Is this possible?
Comments
Post a Comment