Skip to content

Regression with units objects #6356

Closed
Closed
@agila5

Description

@agila5

Dear all,

I think I've found a regression in the ggplot2 package when working with units objects. This is the output with the CRAN version of ggplot2:

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.4.3
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/Rtmpq8oXKc/file4ec82b8451b4 -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      2024-04-23 [1] CRAN (R 4.4.3)
#>  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)
#>  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.
#> 
#> ──────────────────────────────────────────────────────────────────────────────

and this is what happens with the Github version:

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/RtmpYLZFVc/file496c3b055fb3 -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'm not sure whether this is a ggplot2 or units issue but, for the moment, I reported this issue only here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions