plotly / plotly/plotly.R

animated ggplotly: geoms contesting visibility when plotted on same mappings

Ouverte
#1,461 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

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 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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par exécuter la reproduction R fournie avec ggplotly(), en comparant geom_text et geom_point animés entre les frames et avec tooltip = "none". Suivez le chemin de conversion et de rendu de ggplotly animé ; le travail est terminé lorsque les deux geoms restent visibles à chaque frame sans changement de coordonnées au niveau du sous-pixel et que le comportement de tooltip signalé est compris ou corrigé.

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

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.