ggplotly() cannot stop geom_text tooltip, geom will not display on all animation frames
Ouverte
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
- Cannot stop geom_text from displaying tooltip.
- 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)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par exécuter les reproductions R fournies pour ggplotly(), g, g_anim et g_anim2. Suivez le traitement par ggplotly() des aesthetics tooltip et frame ; le travail est terminé lorsque les tooltips de geom_text peuvent être supprimés et que chaque geom apparaît dans chaque frame d’animation, y compris lorsque les données des frames comportent un nombre différent de lignes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100