ggplotly returns group_by_ error for ggplot with undefined dataframe
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
The following ggplot2 command fails when executed in ggplotly:
ggplot()+geom_line(aes(x = c(1,2,3,4), y = c(1,2,3,4), group = c(1,1,2,2))) #works
ggplotly(ggplot()+geom_line(aes(x = c(1,2,3,4), y = c(1,2,3,4), group = c(1,1,2,2)))) #fails
#>Error in UseMethod("group_by_") :
#> no applicable method for 'group_by_' applied to an object of class "waiver"
This error can be addressed by assigning the data to a data frame and explicitly mapping the variables to the data frame within the ggplot call:
df <- data.frame(x = c(1,2,3,4), y = c(1,2,3,4), group = c(1,1,2,2))
ggplotly(ggplot()+geom_line(data = df, aes(x = x, y = y, group = group))) #works
ggplotly(ggplot()+geom_line(aes(x = df$x, y = df$y, group = df$group))) #fails
#>Error in UseMethod("group_by_") :
#> no applicable method for 'group_by_' applied to an object of class "waiver"
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 beiden ggplotly-Beispiele aus dem Issue auszuführen und die erfolgreichen und fehlschlagenden Fälle zu vergleichen. Verfolge, wie ggplotly die Inline-aes-Zuordnungen und den durch waiver dargestellten group-Wert verarbeitet. Die Aufgabe ist erledigt, wenn beide Beispiele ohne den group_by_-Fehler gerendert werden und dabei das Verhalten der gruppierten Linien erhalten bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100