ggplotly can omit geom_lines when they are colour coded within groups
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Create a ggplot graph in which geom_line objects connect data points within a grouping variable and when colour is also mapped to a variable. i.e. the output is a grid of dots in which dots at the same height are connected by horizontal lines:

When passed to the ggplotly function, however, the lines are often omitted. In the reproducible example below, all the lines are omitted, but in other examples, sometimes just individual lines fail to plot. In this example, lines, but not points, do appear in the legend:

To isolate the problem, in the example below, if the colour = time parameter is dropped from the aes() function, then the lines (in monochrome) do get displayed.
library(ggplot2)
library(dplyr)
library(plotly)
# a dataframe with multiple values per case:
d = data.frame(case = as.factor(rep(1:5, each = 4)),
time = as.factor(rep(1:4, times = 5)))
p = d %>%
ggplot(aes(x = time, y = case, colour = time)) +
# produce lines to link points within a case:
geom_line(aes(group = case)) +
geom_point()
print(p) # standard ggplot output includes both lines and points
ggplotly(p) # but plotly output omits lines when colour is specified
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
Beginnen Sie mit dem reproduzierbaren R-Beispiel unter Verwendung von ggplotly(), geom_line(), geom_point() und der Zuordnung von colour zu time; vergleichen Sie dessen Ausgabe mit der Variante mit monochromen Linien. Verfolgen Sie, wie ggplotly gruppierte geom_line-Layer konvertiert, und überprüfen Sie anschließend, dass bei der Zuordnung von colour alle gruppierten Linien erscheinen und dass Punkte und Legenden korrekt bleiben.
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
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100