Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github version of ggplot2 breaks plotting with unit objects #401

Closed
agila5 opened this issue Mar 7, 2025 · 4 comments
Closed

Github version of ggplot2 breaks plotting with unit objects #401

agila5 opened this issue Mar 7, 2025 · 4 comments

Comments

@agila5
Copy link

agila5 commented Mar 7, 2025

Reprex of the problem:

library(ggplot2)
library(units)
#> udunits database from C:/Users/andre/AppData/Local/R/win-library/4.4/units/share/udunits/udunits2.xml

toy <- data.frame(x = set_units(1:10, "m", mode = "standard"))
ggplot(toy) + 
  geom_point(aes(x = x, y = x))
#> Error in make_title(..., self = self): unused arguments (list(), "x")

Created on 2025-03-07 with reprex v2.1.1.9000

Session info
sessioninfo::session_info()
#> Warning in system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", :
#> running command '"quarto"
#> TMPDIR=C:/Users/andre/AppData/Local/Temp/Rtmp2t1L41/file361c709e762f -V' had
#> status 1
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31 ucrt)
#>  os       Windows 11 x64 (build 26100)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Italian_Italy.utf8
#>  ctype    Italian_Italy.utf8
#>  tz       Europe/Rome
#>  date     2025-03-07
#>  pandoc   3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>  quarto   NA @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.6.4      2025-02-13 [1] CRAN (R 4.4.3)
#>  colorspace    2.1-1      2024-07-26 [1] CRAN (R 4.4.2)
#>  digest        0.6.37     2024-08-19 [1] CRAN (R 4.4.2)
#>  dplyr         1.1.4      2023-11-17 [1] CRAN (R 4.4.2)
#>  evaluate      1.0.3      2025-01-10 [1] CRAN (R 4.4.2)
#>  farver        2.1.2      2024-05-13 [1] CRAN (R 4.4.2)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.4.2)
#>  fs            1.6.5      2024-10-30 [1] CRAN (R 4.4.2)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.4.2)
#>  ggplot2     * 3.5.1.9000 2025-03-07 [1] Github (tidyverse/ggplot2@e727e2b)
#>  glue          1.8.0      2024-09-30 [1] CRAN (R 4.4.2)
#>  gtable        0.3.6      2024-10-25 [1] CRAN (R 4.4.2)
#>  htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.4.2)
#>  knitr         1.49       2024-11-08 [1] CRAN (R 4.4.2)
#>  labeling      0.4.3      2023-08-29 [1] CRAN (R 4.4.2)
#>  lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.4.2)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.4.2)
#>  munsell       0.5.1      2024-04-01 [1] CRAN (R 4.4.2)
#>  pillar        1.10.1     2025-01-07 [1] CRAN (R 4.4.2)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.4.2)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.4.2)
#>  Rcpp          1.0.14     2025-01-12 [1] CRAN (R 4.4.2)
#>  reprex        2.1.1.9000 2025-02-25 [1] Github (tidyverse/reprex@07cd5d7)
#>  rlang         1.1.5      2025-01-17 [1] CRAN (R 4.4.2)
#>  rmarkdown     2.29       2024-11-04 [1] CRAN (R 4.4.2)
#>  rstudioapi    0.17.1     2024-10-22 [1] CRAN (R 4.4.2)
#>  scales        1.3.0      2023-11-28 [1] CRAN (R 4.4.2)
#>  sessioninfo   1.2.3      2025-02-05 [1] CRAN (R 4.4.2)
#>  tibble        3.2.1      2023-03-20 [1] CRAN (R 4.4.2)
#>  tidyselect    1.2.1      2024-03-11 [1] CRAN (R 4.4.2)
#>  units       * 0.8-6      2025-03-07 [1] Github (r-quantities/units@4d8d0c1)
#>  vctrs         0.6.5      2023-12-01 [1] CRAN (R 4.4.2)
#>  withr         3.0.2      2024-10-28 [1] CRAN (R 4.4.2)
#>  xfun          0.51.2     2025-02-20 [1] https://yihui.r-universe.dev (R 4.4.2)
#>  yaml          2.3.10     2024-07-26 [1] CRAN (R 4.4.2)
#> 
#>  [1] C:/Users/andre/AppData/Local/R/win-library/4.4
#>  [2] C:/Program Files/R/R-4.4.2/library
#>  * ── Packages attached to the search path.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

I've already raised this problem in the ggplot2 repo (tidyverse/ggplot2#6356) and they suggested that the problem is actually related to the units package and its implementation of make_title(). I've also tried implementing the suggested fix (i.e. adding ... to the arguments, see also https://github.com/agila5/units/tree/add), but the result is quite ugly:

library(ggplot2)
library(units)
#> udunits database from C:/Users/andre/AppData/Local/R/win-library/4.4/units/share/udunits/udunits2.xml

toy <- data.frame(x = set_units(1:10, "m", mode = "standard"))
ggplot(toy) + 
  geom_point(aes(x = x, y = x))

Created on 2025-03-07 with reprex v2.1.1.9000

Session info
sessioninfo::session_info()
#> Warning in system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", :
#> running command '"quarto"
#> TMPDIR=C:/Users/andre/AppData/Local/Temp/RtmpagZjtc/file4b2812ad3389 -V' had
#> status 1
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31 ucrt)
#>  os       Windows 11 x64 (build 26100)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Italian_Italy.utf8
#>  ctype    Italian_Italy.utf8
#>  tz       Europe/Rome
#>  date     2025-03-07
#>  pandoc   3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>  quarto   NA @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.6.4      2025-02-13 [1] CRAN (R 4.4.3)
#>  colorspace    2.1-1      2024-07-26 [1] CRAN (R 4.4.2)
#>  curl          6.2.1      2025-02-19 [1] CRAN (R 4.4.2)
#>  digest        0.6.37     2024-08-19 [1] CRAN (R 4.4.2)
#>  dplyr         1.1.4      2023-11-17 [1] CRAN (R 4.4.2)
#>  evaluate      1.0.3      2025-01-10 [1] CRAN (R 4.4.2)
#>  farver        2.1.2      2024-05-13 [1] CRAN (R 4.4.2)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.4.2)
#>  fs            1.6.5      2024-10-30 [1] CRAN (R 4.4.2)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.4.2)
#>  ggplot2     * 3.5.1.9000 2025-03-07 [1] Github (tidyverse/ggplot2@e727e2b)
#>  glue          1.8.0      2024-09-30 [1] CRAN (R 4.4.2)
#>  gtable        0.3.6      2024-10-25 [1] CRAN (R 4.4.2)
#>  htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.4.2)
#>  knitr         1.49       2024-11-08 [1] CRAN (R 4.4.2)
#>  labeling      0.4.3      2023-08-29 [1] CRAN (R 4.4.2)
#>  lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.4.2)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.4.2)
#>  munsell       0.5.1      2024-04-01 [1] CRAN (R 4.4.2)
#>  pillar        1.10.1     2025-01-07 [1] CRAN (R 4.4.2)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.4.2)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.4.2)
#>  Rcpp          1.0.14     2025-01-12 [1] CRAN (R 4.4.2)
#>  reprex        2.1.1.9000 2025-02-25 [1] Github (tidyverse/reprex@07cd5d7)
#>  rlang         1.1.5      2025-01-17 [1] CRAN (R 4.4.2)
#>  rmarkdown     2.29       2024-11-04 [1] CRAN (R 4.4.2)
#>  rstudioapi    0.17.1     2024-10-22 [1] CRAN (R 4.4.2)
#>  scales        1.3.0      2023-11-28 [1] CRAN (R 4.4.2)
#>  sessioninfo   1.2.3      2025-02-05 [1] CRAN (R 4.4.2)
#>  tibble        3.2.1      2023-03-20 [1] CRAN (R 4.4.2)
#>  tidyselect    1.2.1      2024-03-11 [1] CRAN (R 4.4.2)
#>  units       * 0.8-6      2025-03-07 [1] local
#>  vctrs         0.6.5      2023-12-01 [1] CRAN (R 4.4.2)
#>  withr         3.0.2      2024-10-28 [1] CRAN (R 4.4.2)
#>  xfun          0.51.2     2025-02-20 [1] https://yihui.r-universe.dev (R 4.4.2)
#>  xml2          1.3.6      2023-12-04 [1] CRAN (R 4.4.2)
#>  yaml          2.3.10     2024-07-26 [1] CRAN (R 4.4.2)
#> 
#>  [1] C:/Users/andre/AppData/Local/R/win-library/4.4
#>  [2] C:/Program Files/R/R-4.4.2/library
#>  * ── Packages attached to the search path.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Unfortunately I don't know how to proceed from here 😅

@edzer
Copy link
Member

edzer commented Mar 7, 2025

@Enchufa2 good reason to hold up releasing to CRAN?

@Enchufa2
Copy link
Member

Enchufa2 commented Mar 7, 2025

That's weird. Yes, let me see...

@Enchufa2
Copy link
Member

Enchufa2 commented Mar 7, 2025

This is their bug, they are introducing a backwards incompatible change. And a pretty nasty one, because the label goes now in the third argument instead of the first one. Anyway...

@Enchufa2
Copy link
Member

Enchufa2 commented Mar 7, 2025

Update ready to roll again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants