Skip to content

enable global consistency of color mapping between animation frames #6592

@wybert

Description

@wybert

Hi, Thanks for this AWESOME project. I really enjoy using it.
The animation function can't keep the global consistency of color mapping between animation frames.

Here is an example in Colab for my use case. In this example, I use Plotly.py with scatter_geo API. My code is as between,

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

I expect the color mapping for lifeExp to keep consistent between different frames, which means the same color among frames should represent the same lifeExp value and the color bar should keep the same too. But the result looks like below, in which the frames in 1952 and 1997 can't be comparable.

image

image

I would expect some API like,

fig = px.scatter_geo(df, locations="iso_alpha", 
                     color="lifeExp",
                     keep_color_global_consistency = True,
                     hover_name="country", 
                     size="pop",
                     animation_frame="year",
                     projection="natural earth")

eg, it has keep_color_global_consistency option and the default value should be True.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions