ggforce
ggforce copied to clipboard
ggplot2 3.3.0 + ggforce 0.3.1 drops axes labels
It seems that ggplot2
3.3.0 broke ggforce
0.3.1 axes labels:
Here is a reprex from the examples:
library(ggforce)
library(units)
gallon <- as_units('gallon')
mtcars$consumption <- mtcars$mpg * with(ud_units, mi / gallon)
mtcars$power <- mtcars$hp * with(ud_units, hp)
# Use units encoded into the data
ggplot(mtcars) +
geom_point(aes(power, consumption))
For some reason I can't upload to imgr any longer, so the reprex::reprex
doesn't work
Its working today
library(ggforce)
#> Loading required package: ggplot2
library(units)
#> udunits system database from /usr/share/udunits
gallon <- as_units('gallon')
mtcars$consumption <- mtcars$mpg * with(ud_units, mi / gallon)
mtcars$power <- mtcars$hp * with(ud_units, hp)
# Use units encoded into the data
ggplot(mtcars) +
geom_point(aes(power, consumption))
Created on 2020-03-10 by the reprex package (v0.3.0)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.0 (2019-04-26)
#> os Gentoo/Linux
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate en_US.utf8
#> ctype en_US.utf8
#> tz US/Central
#> date 2020-03-10
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
#> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.0)
#> callr 3.4.2 2020-02-12 [1] CRAN (R 3.6.0)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.0)
#> colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
#> curl 4.3 2019-12-02 [1] CRAN (R 3.6.0)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0)
#> devtools 2.2.2 2020-02-17 [1] CRAN (R 3.6.0)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.0)
#> dplyr 0.8.5 2020-03-07 [1] CRAN (R 3.6.0)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.0)
#> farver 2.0.3 2020-01-16 [1] CRAN (R 3.6.0)
#> fs 1.3.2 2020-03-05 [1] CRAN (R 3.6.0)
#> ggforce * 0.3.1 2019-08-20 [1] CRAN (R 3.6.0)
#> ggplot2 * 3.3.0 2020-03-05 [1] CRAN (R 3.6.0)
#> glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.0)
#> gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.0)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
#> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.0)
#> httr 1.4.1 2019-08-05 [1] CRAN (R 3.6.0)
#> knitr 1.28 2020-02-06 [1] CRAN (R 3.6.0)
#> labeling 0.3 2014-08-23 [1] CRAN (R 3.6.0)
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.0)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
#> MASS 7.3-51.4 2019-03-31 [2] CRAN (R 3.6.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
#> mime 0.9 2020-02-04 [1] CRAN (R 3.6.0)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0)
#> pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.0)
#> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0)
#> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
#> polyclip 1.10-0 2019-03-14 [1] CRAN (R 3.6.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.0)
#> processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.0)
#> ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.0)
#> purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.0)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.0)
#> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.0)
#> remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.0)
#> rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.0)
#> rmarkdown 2.1 2020-01-20 [1] CRAN (R 3.6.0)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
#> scales 1.1.0 2019-11-18 [1] CRAN (R 3.6.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.0)
#> tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.0)
#> tidyselect 1.0.0 2020-01-27 [1] CRAN (R 3.6.0)
#> tweenr 1.0.1 2018-12-14 [1] CRAN (R 3.6.0)
#> units * 0.6-5 2019-10-08 [1] CRAN (R 3.6.0)
#> usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.0)
#> withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0)
#> xfun 0.12 2020-01-13 [1] CRAN (R 3.6.0)
#> xml2 1.2.2 2019-08-09 [1] CRAN (R 3.6.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.0)
#>
#> [1] /home/matt/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/lib64/R/library
The plot below with the axes ticks and tick labels is what I expect:
##devtools::install_version("ggplot2", version = "3.2.1", repos = "http://cran.us.r-project.org")
library(ggforce)
#> Loading required package: ggplot2
library(units)
#> udunits system database from /usr/share/udunits
gallon <- as_units('gallon')
mtcars$consumption <- mtcars$mpg * with(ud_units, mi / gallon)
mtcars$power <- mtcars$hp * with(ud_units, hp)
# Use units encoded into the data
ggplot(mtcars) +
geom_point(aes(power, consumption))
Created on 2020-03-10 by the reprex package (v0.3.0)
Hello,
Just to share it may be related to
Rewrite of axis code While Dewey has worked on a lot of different parts of the ggplot2 code base, the lion’s share has been concerned with a rewrite of the positional-guide (axis) internals. While, at a high level, axes and legends are equivalent (they are both guides used for scales), this has not been true for the underlying code. [...] -- ggplot2 3.3.0 blog post
Best
In fact this issue is already referenced in #188 and has been fixed in commit b21e445.
So you can switch to the development version while waiting for the new version to be released ( devtools::install_github("thomasp85/ggforce")
).
Best
Thanks @romainx