Bubble changing color and representing a different category in animated scatter plot
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
I was trying to create an animated scatter plot with each bubble representing a race category indicated by a color. In the actual data set, some race categories don't data in certain years. When those years were excluded, the plot looked fine. However, when those years were not excluded, some bubbles changed colors and turned into a different race category . For example, in the code below, race 4 changed into race 5 in year 6 when race 4 actually does not have data in year 6 - year 9. Thanks!
str <-
"seq, race, achievement, growth, size
year 1, race 6, 41.5, 35.5, 54
year 2, race 6, 45.5, 48.5, 54
year 3, race 6, 37.0, 34.5, 64
year 4, race 6, 42.0, 29.5, 62
year 5, race 6, 39.0, 40.0, 60
year 6, race 6, 39.0, 41.0, 71
year 7, race 6, 33.0, 40.0, 74
year 8, race 6, 25.0, 42.0, 59
year 9, race 6, 24.0, 55.0, 59
year 1, race 2, 22.0, 36.0, 357
year 2, race 2, 23.0, 43.0, 357
year 3, race 2, 21.0, 42.0, 359
year 4, race 2, 18.0, 45.0, 364
year 5, race 2, 21.0, 42.0, 351
year 6, race 2, 20.0, 54.0, 353
year 7, race 2, 17.0, 41.0, 370
year 8, race 2, 13.0, 46.0, 319
year 9, race 2, 14.0, 48.0, 318
year 1, race 3, 39.0, 47.0, 2
year 2, race 3, 29.5, 28.5, 2
year 3, race 3, 36.0, 29.5, 2
year 4, race 3, 34.5, 64.5, 2
year 5, race 3, 35.5, 70.5, 2
year 6, race 3, 69.0, 35.0, 1
year 7, race 3, 60.0, 21.0, 1
year 1, race 5, 65.0, 59.0, 23
year 2, race 5, 68.0, 44.0, 23
year 3, race 5, 54.0, 57.0, 17
year 4, race 5, 49.0, 43.0, 19
year 5, race 5, 45.5, 49.0, 20
year 6, race 5, 54.0, 64.0, 23
year 7, race 5, 48.0, 56.0, 32
year 8, race 5, 37.0, 68.0, 35
year 9, race 5, 37.0, 58.0, 37
year 1, race 7, 35.0, 46.0, 99
year 2, race 7, 40.0, 57.5, 100
year 3, race 7, 37.0, 40.0, 113
year 4, race 7, 36.0, 51.5, 110
year 5, race 7, 33.0, 41.0, 108
year 6, race 7, 39.0, 53.0, 101
year 7, race 7, 30.0, 40.0, 106
year 8, race 7, 28.0, 53.0, 111
year 9, race 7, 28.0, 53.0, 106
year 1, race 4, 74.5, 93.0, 2
year 2, race 4, 69.5, 80.5, 2
year 3, race 4, 84.0, 98.0, 1
year 4, race 4, 82.0, 44.0, 1
year 5, race 4, 60.0, 3.0, 1
year 1, race 1, 47.0, 38.0, 461
year 2, race 1, 48.0, 42.5, 454
year 3, race 1, 49.0, 41.0, 449
year 4, race 1, 48.0, 52.0, 461
year 5, race 1, 47.0, 42.0, 448
year 6, race 1, 52.0, 47.0, 412
year 7, race 1, 47.0, 39.0, 416
year 8, race 1, 38.0, 46.5, 362
year 9, race 1, 41.0, 51.0, 362"
dt <- read.table(textConnection(str), header=T, sep=",", na.strings=" ")
plot_ly(dt) %>%
add_markers(x = ~achievement, y = ~growth, size = ~size,
color = ~race,
frame = ~seq,
hoverinfo = 'text', text = ~paste(race, size, sep = '\n'),
marker = list(opacity = 0.5, sizemode = 'diameter'))
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 eseguendo l’esempio R riproducibile dell’issue con plotly.R e confronta i frame animati in cui la gara 4 non ha dati. Traccia il modo in cui i valori dei frame vengono associati ai colori dei marker. Il lavoro è completato quando ogni gara mantiene il colore assegnato quando mancano categorie negli anni successivi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100