Animation deletes traces
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Below is a minimal example, where using a slider to show different traces will delete another trace.
The example plots a grid of points and uses a slider to interactively display selected rows, however, the original grid plot disappears as soon as the slider is moved.
This looks like a bug to me. If it’s not, how can I prevent that trace from disappearing?
import numpy as np
import plotly.graph_objects as go
# generate grid
N = 10
x, y = np.meshgrid(np.linspace(0, 1, N), np.linspace(0, 1, N))
z = np.zeros((N, N))
# plot
fig = go.Figure(
# all points (THIS DISAPPEARS!)
data=[go.Scatter3d(x=x.flatten(), y=y.flatten(), z=z.flatten())],
# single rows animated via slider
frames=[go.Frame(data=[go.Scatter3d(x=x[i], y=y[i], z=z[i])], name=f"{i}") for i in range(N)],
layout_sliders=[dict(steps=[dict(method='animate', args=[[f"{k}"]], label=f"{k}") for k in range(N)])])
fig.write_html('plot.html')
fig.show()
Two other weird things (potential bugs), which might be unrelated:
- Setting a marker size on the first trace also changes the marker size of the animated traces. Should that be the case?!
- The interactively opened plot behaves differently from opening the saved html plot (the second one starts playing the animation right away, the first one doesn’t).
I have also posted this in the community forum but without any reactions so far.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行最小 Python 示例,并比较 fig.show() 的交互式结果与保存的 plot.html。调查动画帧和 slider 行为,包括消失的网格 trace、共享的 marker 大小以及不同的 autoplay 行为;当观察到的行为得到解释,并且确认的 bug 已在不破坏其他 trace 的情况下修复时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100