ggplotly can omit geom_lines when they are colour coded within groups
Nessuno ha ancora preso questa issue.
- Lingua principale
- R
- Stelle
- 2.7k
- Fork
- 641
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’esempio R riproducibile che utilizza ggplotly(), geom_line(), geom_point() e colour associato a time; confronta il suo output con la variante a linee monocromatiche. Traccia il modo in cui ggplotly converte i layer geom_line raggruppati, quindi verifica che tutte le linee raggruppate appaiano quando colour è associato e che punti e legende rimangano corretti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100