animated ggplotly: geoms contesting visibility when plotted on same mappings
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Cannot plot geom_point and geom_line on same mappings in animated ggplotly()
Creating a ggplot object (with frame) and calling in ggplotly(). I expect to be able to view geom_point and geom_text mapped to the variables. I sometimes observe one being displayed on more frames while the other flys in from the top left in one or few frames.
work around: add sub-pixel changes to one or both geoms till working.
library(ggplot2)
library(plotly)
rn <- data.frame(rn = 1:5)
x <- data.frame(scale(mtcars), lab=abbreviate(rownames(mtcars),2))
x_cross <- merge(x, rn, all = TRUE) # cross join
# Only text or points show, not both
gg1 <- ggplot() +
geom_text(data=x_cross, mapping = aes(x=disp, y=hp, label=lab, frame=rn)) +
geom_point(data=x_cross, mapping = aes(x=disp, y=hp, frame=rn),color="red") +
theme_void()
gg1
ggplotly(gg1)
# Text and points show for all frames
gg2 <- ggplot() +
geom_text(data=x_cross, mapping = aes(x=disp+.1*rn, y=hp, label=lab, frame=rn)) +
geom_point(data=x_cross, mapping = aes(x=disp+.1*rn, y=hp, frame=rn),color="red") +
theme_void()
gg2
ggplotly(gg2)
# tooltip = "none", changes behaviour, points don't show up.
ggplotly(gg2, tooltip = "none")
Cheers,
Nick
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 ggplotly() 运行所提供的 R 复现代码,比较动画 geom_text 和 geom_point 在各帧之间以及 tooltip = "none" 时的表现。跟踪动画 ggplotly 的转换和渲染路径;完成标准是两个 geom 在每一帧中都保持可见,且坐标没有子像素级变化,同时已理解或修正所报告的 tooltip 行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100