Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To utilize animation_frame in choropleth maps generated through plotly express, you can use the animation_frame parameter in px.choropleth() method. For example:

import plotly.express as px
df = px.data.gapminder()
fig = px.choropleth(df, locations="iso_alpha", color="lifeExp",
                    animation_frame="year",
                    projection="natural earth")
fig.show()

This will create an animated choropleth map with frames based on the year column.

To obtain a distinct slider for subplots in choropleth maps, you can specify the facet_row and/or facet_col parameters in px.choropleth() and use the animation_frame parameter to create an animation over the generated subplots. For example:

import plotly.express as px
df = px.data.gapminder()
fig = px.choropleth(df, locations="iso_alpha", color="lifeExp",
                    animation_frame="year",
                    projection="natural earth",
                    facet_col="region")
fig.show()

This will create a choropleth map with subplots based on the region column, and a distinct slider for each subplot based on the year column.