ggplotly can omit geom_lines when they are colour coded within groups
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo reproducible en R usando ggplotly(), geom_line(), geom_point() y colour asignado a time; compara su salida con la variante de líneas monocromáticas. Traza cómo ggplotly convierte las capas agrupadas de geom_line y verifica después que aparezcan todas las líneas agrupadas cuando colour está asignado, y que los puntos y las leyendas sigan siendo correctos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- r
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100