-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Backticks in labels when aesthetics are defined in a geom #3186
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
Comments
I'm not able to reproduce this with the development version of ggplot2. Is that what you're running as well? If so, could you append your session info? Thanks library(ggplot2)
data <- tibble::tibble(
"variable with space" = 1:5
)
ggplot(data) +
aes(x = `variable with space`, y = `variable with space`) +
geom_point() library(ggplot2)
data <- tibble::tibble(
"variable with space" = 1:5
)
ggplot(data) +
geom_point(aes(x = `variable with space`, y = `variable with space`)) Created on 2019-03-14 by the reprex package (v0.2.1) Session infodevtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#> setting value
#> version R version 3.5.2 (2018-12-20)
#> os macOS Mojave 10.14.3
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/New_York
#> date 2019-03-14
#>
#> ─ Packages ──────────────────────────────────────────────────────────────
#> package * version date lib
#> assertthat 0.2.0 2017-04-11 [1]
#> backports 1.1.3 2018-12-14 [1]
#> callr 3.1.1.9000 2018-12-21 [1]
#> cli 1.0.1.9000 2019-01-24 [1]
#> colorspace 1.4-0 2019-01-13 [1]
#> crayon 1.3.4 2018-12-17 [1]
#> curl 3.3 2019-01-10 [1]
#> desc 1.2.0 2018-12-11 [1]
#> devtools 2.0.1.9000 2019-02-19 [1]
#> digest 0.6.18 2018-10-10 [1]
#> dplyr 0.8.0.9004 2019-03-04 [1]
#> evaluate 0.13 2019-02-12 [1]
#> fs 1.2.6 2018-08-23 [1]
#> ggplot2 * 3.1.0.9000 2019-03-14 [1]
#> glue 1.3.1 2019-03-12 [1]
#> gtable 0.2.0.9000 2019-03-14 [1]
#> highr 0.7 2018-06-09 [1]
#> htmltools 0.3.6 2017-04-28 [1]
#> httr 1.4.0 2018-12-11 [1]
#> knitr 1.22 2019-03-08 [1]
#> labeling 0.3 2014-08-23 [1]
#> lazyeval 0.2.1 2017-10-29 [1]
#> magrittr 1.5 2014-11-22 [1]
#> memoise 1.1.0 2017-04-21 [1]
#> mime 0.6 2018-10-05 [1]
#> munsell 0.5.0 2018-06-12 [1]
#> pillar 1.3.1.9000 2019-01-24 [1]
#> pkgbuild 1.0.2.9000 2018-11-13 [1]
#> pkgconfig 2.0.2 2018-08-16 [1]
#> pkgload 1.0.2 2018-10-29 [1]
#> prettyunits 1.0.2 2015-07-13 [1]
#> processx 3.3.0 2019-03-10 [1]
#> ps 1.3.0 2018-12-21 [1]
#> purrr 0.3.1 2019-03-03 [1]
#> R6 2.4.0 2019-02-14 [1]
#> Rcpp 1.0.0 2018-11-07 [1]
#> remotes 2.0.2.9000 2019-02-25 [1]
#> rlang 0.3.1.9000 2019-03-14 [1]
#> rmarkdown 1.12 2019-03-14 [1]
#> rprojroot 1.3-2 2018-01-03 [1]
#> scales 1.0.0.9000 2019-01-30 [1]
#> sessioninfo 1.1.1 2018-11-05 [1]
#> stringi 1.4.3 2019-03-12 [1]
#> stringr 1.4.0 2019-02-10 [1]
#> testthat 2.0.1 2018-10-13 [1]
#> tibble 2.1.0 2019-03-14 [1]
#> tidyselect 0.2.5 2018-10-11 [1]
#> usethis 1.4.0.9000 2019-02-19 [1]
#> withr 2.1.2.9000 2018-11-13 [1]
#> xfun 0.5 2019-02-20 [1]
#> xml2 1.2.0 2018-01-24 [1]
#> yaml 2.2.0 2018-07-25 [1]
#> source
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.1)
#> Github (r-lib/callr@6413af8)
#> Github (r-lib/cli@94e2fc5)
#> CRAN (R 3.5.2)
#> Github (r-lib/crayon@74bee76)
#> CRAN (R 3.5.2)
#> Github (r-lib/desc@42b9578)
#> Github (r-lib/devtools@188a613)
#> CRAN (R 3.5.0)
#> Github (tidyverse/dplyr@3dc0762)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> Github (tidyverse/ggplot2@ae1c8f0)
#> CRAN (R 3.5.2)
#> Github (r-lib/gtable@d590d89)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#> Github (r-lib/pillar@3a54b8d)
#> Github (r-lib/pkgbuild@6e4ebdf)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> Github (r-lib/remotes@6212345)
#> Github (r-lib/rlang@2306f44)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> Github (r-lib/scales@c374014)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> Github (tidyverse/tibble@3d831c5)
#> CRAN (R 3.5.1)
#> Github (r-lib/usethis@0adfb5d)
#> Github (r-lib/withr@be57595)
#> CRAN (R 3.5.2)
#> CRAN (R 3.5.0)
#> CRAN (R 3.5.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library |
I think this was fixed by @yutannihilation in #2981 ! |
library(ggplot2)
data <- tibble::tibble(
"variable with space" = 1:5
)
ggplot(data) +
geom_point(aes(x = `variable with space`, y = `variable with space`)) Created on 2019-03-14 by the reprex package (v0.2.1) Session infodevtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.5.1 (2018-07-02)
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz Europe/Berlin
#> date 2019-03-14
#> Packages -----------------------------------------------------------------
#> package * version date source
#> assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0)
#> base * 3.5.1 2018-07-05 local
#> colorspace 1.4-0 2019-01-13 CRAN (R 3.5.2)
#> compiler 3.5.1 2018-07-05 local
#> crayon 1.3.4 2017-09-16 CRAN (R 3.5.0)
#> curl 3.2 2018-03-28 CRAN (R 3.5.0)
#> datasets * 3.5.1 2018-07-05 local
#> devtools 1.13.6 2018-06-27 CRAN (R 3.5.0)
#> digest 0.6.18 2018-10-10 cran (@0.6.18)
#> dplyr 0.8.0.1 2019-02-15 CRAN (R 3.5.2)
#> evaluate 0.10.1 2017-06-24 CRAN (R 3.5.0)
#> ggplot2 * 3.1.0 2018-10-25 CRAN (R 3.5.0)
#> glue 1.3.0 2018-07-17 cran (@1.3.0)
#> graphics * 3.5.1 2018-07-05 local
#> grDevices * 3.5.1 2018-07-05 local
#> grid 3.5.1 2018-07-05 local
#> gtable 0.2.0 2016-02-26 CRAN (R 3.5.0)
#> highr 0.7 2018-06-09 CRAN (R 3.5.0)
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0)
#> httr 1.3.1 2017-08-20 CRAN (R 3.5.0)
#> knitr 1.22 2019-03-08 CRAN (R 3.5.2)
#> labeling 0.3 2014-08-23 CRAN (R 3.5.0)
#> lazyeval 0.2.1 2017-10-29 CRAN (R 3.5.0)
#> magrittr 1.5 2014-11-22 CRAN (R 3.5.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.5.0)
#> methods * 3.5.1 2018-07-05 local
#> mime 0.5 2016-07-07 CRAN (R 3.5.0)
#> munsell 0.5.0 2018-06-12 cran (@0.5.0)
#> pillar 1.3.1 2018-12-15 CRAN (R 3.5.0)
#> pkgconfig 2.0.2 2018-08-16 cran (@2.0.2)
#> plyr 1.8.4 2016-06-08 CRAN (R 3.5.0)
#> purrr 0.3.1 2019-03-03 CRAN (R 3.5.2)
#> R6 2.4.0 2019-02-14 CRAN (R 3.5.2)
#> Rcpp 1.0.0 2018-11-07 CRAN (R 3.5.0)
#> rlang 0.3.1 2019-01-08 CRAN (R 3.5.2)
#> rmarkdown 1.11 2018-12-08 CRAN (R 3.5.0)
#> scales 1.0.0 2018-08-09 cran (@1.0.0)
#> stats * 3.5.1 2018-07-05 local
#> stringi 1.3.1 2019-02-13 CRAN (R 3.5.2)
#> stringr 1.4.0 2019-02-10 CRAN (R 3.5.2)
#> tibble 2.0.1 2019-01-12 CRAN (R 3.5.2)
#> tidyselect 0.2.5 2018-10-11 cran (@0.2.5)
#> tools 3.5.1 2018-07-05 local
#> utils * 3.5.1 2018-07-05 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.5.0)
#> xfun 0.5 2019-02-20 CRAN (R 3.5.2)
#> xml2 1.2.0 2018-01-24 CRAN (R 3.5.0)
#> yaml 2.2.0 2018-07-25 cran (@2.2.0) |
@batpigandme I guess then we can close the issue |
Sounds good! |
Yes, this is already fixed in the dev version. Thanks, Mara! |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
ggplot2 adds backticks around variable labels if those variables contain a space and the aesthetics are defined in the geom and not globally.
No backticks:
Created on 2019-03-14 by the reprex package (v0.2.1)
Backticks:
Created on 2019-03-14 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: