Skip to content

Bad display in geom_col when having over 100 dates #414

Description

@etiennebacher

I would like to see the evolution of a variable over more than 100 years. I noticed that when having more than 100 dates, the gif has a strange behavior where the columns "lag" (it is not the right word but I don't know how to describe it, see below):

library(tidyverse)
library(gganimate)

test_tibble <- tibble(
  country = rep(c("A", "B"), each = 101),
  year = rep(1:101, times = 2),
  variable = rep(seq(10, 1010, by = 10), times = 2)
)

test_tibble %>%
  ggplot(aes(x = factor(country), y = variable)) + 
  geom_col() +
  transition_time(year) +
  ease_aes('linear')

In the gif below, the problem appears when columns reach 500:
withlag

However, if I reduce the number of observations to exactly 100 (or less) for both columns, then the gif is fine:

test_tibble %>%
  filter(year < 101) %>%
  ggplot(aes(x = factor(country), y = variable)) + 
  geom_col() +
  transition_time(year) +
  ease_aes('linear')

withoutlag

Any idea why?

Thanks for this great package ;)

Session info
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base

other attached packages:
[1] gganimate_1.0.6 forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2
[5] purrr_0.3.4 readr_1.3.1 tidyr_1.1.2 tibble_3.0.3
[9] ggplot2_3.3.2 tidyverse_1.3.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 lubridate_1.7.9 prettyunits_1.1.1
[4] assertthat_0.2.1 digest_0.6.25 packrat_0.5.0
[7] R6_2.4.1 cellranger_1.1.0 plyr_1.8.6
[10] backports_1.1.10 reprex_0.3.0 evaluate_0.14
[13] httr_1.4.2 blogdown_0.20 pillar_1.4.6
[16] rlang_0.4.7 progress_1.2.2 readxl_1.3.1
[19] rstudioapi_0.11 blob_1.2.1 magick_2.4.0
[22] rmarkdown_2.4 labeling_0.3 munsell_0.5.0
[25] broom_0.7.0 compiler_4.0.3 modelr_0.1.8
[28] janitor_2.0.1 xfun_0.18 pkgconfig_2.0.3
[31] htmltools_0.5.0 tidyselect_1.1.0 bookdown_0.20
[34] fansi_0.4.1 crayon_1.3.4 dbplyr_1.4.4
[37] withr_2.3.0 grid_4.0.3 jsonlite_1.7.1
[40] gtable_0.3.0 lifecycle_0.2.0 DBI_1.1.0
[43] magrittr_1.5 scales_1.1.1 cli_2.0.2
[46] stringi_1.5.3 farver_2.0.3 fs_1.5.0
[49] ggthemes_4.2.0 snakecase_0.11.0 xml2_1.3.2
[52] ellipsis_0.3.1 generics_0.0.2 vctrs_0.3.4
[55] tools_4.0.3 glue_1.4.2 tweenr_1.0.1
[58] hms_0.5.3 RcppTOML_0.1.6 yaml_2.2.1
[61] colorspace_1.4-1 rvest_0.3.6 knitr_1.30
[64] haven_2.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions