Unexpected behavior with geom_rect and ids arg in ggplotly()
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
Expected behavior demonstrated by geom_point. See ggplotly(gg1) below.
Unexpected behavior when using geom_rect with the ids arg across frames with changing number of observations. See ggplotly(gg2) and ggplotly(gg3) below.
### Win 10 x64, Rstudio
library(ggplot2) # ggplot2_3.0.0
library(plotly) # plotly_4.7.1
data(gapminder, package = "gapminder")
# filtering out some countries (soframes have differing number of obs)
sub_countries <- unique(gapminder$country)[1:10]
gapminder2 <- gapminder %>%
filter(((year != 1952) | (country %in% sub_countries)) & year < 1970)
# using geom_point (works)
gg1 <- ggplot(gapminder2) +
geom_point(aes(x = gdpPercap, y = lifeExp,
ids = country,
frame = year)) +
scale_x_log10()
ggplotly(gg1) # correct: sub, full, full, full
# using geom_rect (doesn't work with ids arg)
gg2 <- ggplot(gapminder2) +
geom_rect(aes(xmin = gdpPercap, ymin = lifeExp,
xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp,
ids = country,
frame = year)) +
scale_x_log10()
ggplotly(gg2) # incorrect: sub, sub, sub, sub
# using geom_rect, subset on 2nd frame (doesn't work with ids arg)
gapminder3 <- gapminder %>%
filter(((year != 1957) | (country %in% sub_countries)) & year < 1970)
gg3 <- ggplot(gapminder3) +
geom_rect(aes(xmin = gdpPercap, ymin = lifeExp,
xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp,
ids = country,
frame = year)) +
scale_x_log10()
ggplotly(gg3) # incorrect: full, sub moves, full, full
# frame year 1952 -> 1957 != 1962 -> 1957 != 1967 -> 1957
Cheers,
Nick
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
Esegui la riproduzione R fornita con ggplot2 e plotly, confrontando geom_point e geom_rect tra frame con un numero variabile di osservazioni. Traccia il percorso di conversione di ggplotly per geom_rect, ids e la gestione dei frame. Il lavoro è completo quando geom_rect conserva le osservazioni e gli ids corretti in ogni frame, corrispondendo al comportamento atteso dimostrato.
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
- Abbastanza chiara
- Idoneità per principianti
- 45/100