plotly / plotly/plotly.js

enable global consistency of color mapping between animation frames

Open
#6,592 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linked Colab example with scatter_geo, color, and animation_frame. Read how color mapping and color bars are handled across animation frames, then define the API behavior so equal values use comparable colors and the color bar remains fixed; done means the 1952 and 1997 frames are directly comparable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.