The fitbounds parameter appear not to work when used in choropleth mapbox. The only way I found to pass it to the Figure object was to use the update_geos method.
The following is a sample of the code to show the parameter used:
fig = px.choropleth_mapbox(
df,
geojson=self.geojson,
featureidkey=self.featureidkey,
locations="location_code,
color=self.metric,
mapbox_style="carto-positron",
opacity=0.4
)
fig.update_geos(fitbounds="locations")
When calling fig.show, the plot opens to the (0,0) location in Gulf of Guinea.
Why the fitbounds parameter doesn't work on choropleth mapbox?
The
fitboundsparameter appear not to work when used in choropleth mapbox. The only way I found to pass it to the Figure object was to use theupdate_geosmethod.The following is a sample of the code to show the parameter used:
When calling
fig.show, the plot opens to the (0,0) location in Gulf of Guinea.Why the
fitboundsparameter doesn't work on choropleth mapbox?