plotly / plotly/plotly.js

enable global consistency of color mapping between animation frames

未关闭
#6,592 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用 scatter_geo、color 和 animation_frame 复现链接的 Colab 示例。了解动画帧之间如何处理颜色映射和颜色条,然后定义 API 行为,使相等的值使用可比较的颜色,并使颜色条保持固定;当 1952 年和 1997 年的帧可以直接比较时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, python
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。