Color group does not appear in the animated plotly
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
I am trying to plot an animated frame with plotly. The goal is to plot how some units (id) changes in two continuous variables AND one categorical. The problem arises because the third category appears not from the beginning. In the plot, the units with “type3” category do not appear on the plot after 2001 and the ‘type3’ entry does not appear in the legend. The code shows an example of the data structure and problem. The same problem with boxplot - only two categories are present for all frames.
The ideal result is appearing of all 3 groups form the beginning. For scatterplot, points should change the color and for boxplot there should be an empty space from the beginning for the third category or it should appear after reaching the proper year.
df <- data.frame(x = rnorm(50),
y = rnorm(50),
year = c(rep(2000, 10), rep(2001, 10), rep(2002, 10), rep(2003, 10), rep(2004, 10)),
id = rep(1:10, 5),
model = c(rep('type1', 5), rep('type2', 5), rep('type1', 5) , rep('type2', 5),
rep('type1', 3), rep('type2', 2), rep('type3', 5) ,
rep('type1', 4), rep('type2', 5), rep('type3', 1) ,
rep('type1', 3), rep('type2', 2), rep('type3', 5) ))
cols <- c(
"type1" = "#bc80bd",
"type2" = "#fdb462",
"type3" = "#b3de69"
)
plot_ly(df, x = ~x,
y= ~y,
color = ~model,
text = ~id,
frame = ~year,
opacity = .8,
marker = list(size = 10),
colors = cols,
type = 'scatter')
plot_ly(df,
y= ~y,
color = ~model,
frame = ~year,
opacity = .8,
colors = cols,
type = 'box')
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 ejecutando los ejemplos proporcionados en R para gráficos de dispersión y diagramas de caja animados; después, compara la leyenda de categorías y las trazas entre los frames de los años. El issue está resuelto cuando type3 se gestiona de forma coherente desde el principio, con el comportamiento esperado del color y la leyenda para los gráficos de dispersión y una apariencia vacía o tardía definida para los diagramas de caja.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- plotly, r
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100