Unexpected behavior with geom_rect and ids arg in ggplotly()
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
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
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
Exécutez la reproduction R fournie avec ggplot2 et plotly, en comparant geom_point et geom_rect entre des frames dont le nombre d’observations change. Suivez le chemin de conversion de ggplotly pour geom_rect, ids et la gestion des frames. C’est terminé lorsque geom_rect conserve les observations et les ids corrects dans chaque frame, conformément au comportement attendu démontré.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- 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
- 45/100