Fixed legend for Animation

Hello,

I am making an animation for weather conditions w.r.t time, on the press of the play button the animation will start. But the problem is that the legend changes each time according to the maximum and minimum value of wind speed in each plot. Can anyone suggest to me, the way to make fixed legends for all plots?

Thank you in advance.

Hello @anikaslam ,

You can define the minimum and maximum values in a plotly animation by setting range_color. This option will produce an static legend and no changes in size while animated.

For example:

fig = px.choropleth(data,
			locations="country_code",
			color="population",
			hover_name="country",
			color_continuous_scale="magma_r",
			range_color=(0,1000),
			animation_frame="date")

Hope it helps :slight_smile: