Skip to content

fitbounds="locations" parameter not working for px.choropleth_map #4262

Description

@mattiatantardini

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions