plotly / plotly/plotly.R

ggplotly() cannot stop geom_text tooltip, geom will not display on all animation frames

未关闭
#2,060 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

  1. Cannot stop geom_text from displaying tooltip.
  2. Animations will not display all geoms on all frames (note that data has differing rownumers
library(ggplot2)
library(plotly)
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout

df_txt <- data.frame(x=1, y=1, label="No tooltip here, please", frame = 1:2)
df_pts <- data.frame(x=rep(c(1, 1), each=2), y=c(.9, .95, .8, .85),
                     tooltip=paste("obs_num: ", 1:2, "tooltip exclusively for points with different dim"),
                     frame = rep(1:2, each=2))

## static plot, no frames
g <- ggplot() +
  geom_text(aes(x,y, label=label), df_txt) +
  geom_point(aes(x,y, tooltip=tooltip), df_pts)
#> Warning: Ignoring unknown aesthetics: tooltip

plotly::ggplotly(g, tooltip = "tooltip")

## Issue 1) geom_text tooltips are unstopable:
plotly::ggplotly(g, tooltip = NULL)

# plotly::ggplotly(g, tooltip = FALSE)
# plotly::ggplotly(g, tooltip = "foobar")

## animation, aes has frame
g_anim <- ggplot() +
  geom_text(aes(x,y, label=label, frame = frame), df_txt) +
  geom_point(aes(x,y, tooltip=tooltip, frame = frame), df_pts)
#> Warning: Ignoring unknown aesthetics: frame
#> Warning: Ignoring unknown aesthetics: tooltip, frame

## Issue 2) seeing common frame 1 issues, where some geoms display only on frame 1.
# then other apeear semi consistently in other frames. 
plotly::ggplotly(g_anim, tooltip = "tooltip")

## Not a tooltip issue as I was worrying.
g_anim2 <- ggplot() +
  geom_text(aes(x,y, label="existential crisis with points and text", frame = frame), df_txt) +
  geom_point(aes(x,y, frame = frame), df_pts)
#> Warning: Ignoring unknown aesthetics: frame
#> Warning: Ignoring unknown aesthetics: frame
plotly::ggplotly(g_anim2)

Created on 2021-10-28 by the reprex package (v2.0.1)

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先运行为 ggplotly()、g、g_anim 和 g_anim2 提供的 R 复现。跟踪 ggplotly() 对 tooltip 和 frame aesthetics 的处理;完成的标志是可以抑制 geom_text 的 tooltip,并且每个 geom 都出现在每个动画帧中,包括 frame 数据具有不同​​行数的情况。

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

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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