animated ggplotly: geoms contesting visibility when plotted on same mappings
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die bereitgestellte R-Reproduktion mit ggplotly() auszuführen und animiertes geom_text und geom_point über die Frames hinweg sowie mit tooltip = "none" zu vergleichen. Verfolge den Konvertierungs- und Rendering-Pfad von animiertem ggplotly; als erledigt gilt, dass beide Geoms in jedem Frame ohne Änderungen der Koordinaten im Subpixelbereich sichtbar bleiben und das gemeldete Tooltip-Verhalten verstanden oder korrigiert ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100