Color group does not appear in the animated plotly
Personne n'a encore pris cette issue.
- Langage dominant
- R
- Étoiles
- 2.7k
- Forks
- 641
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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')
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par exécuter les exemples R fournis pour les nuages de points et les boîtes à moustaches animés, puis comparez la légende des catégories et les traces entre les frames correspondant aux années. L'issue est résolue lorsque type3 est géré de manière cohérente dès le début, avec le comportement attendu de la couleur et de la légende pour les nuages de points, ainsi qu'une apparence vide ou tardive définie pour les boîtes à moustaches.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- plotly, r
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100