wilkox / treemapify

🌳 Draw treemaps in ggplot2
http://wilkox.org/treemapify
213 stars 18 forks source link

geom_treemap_text() does not appear to create labels #31

Closed copernican closed 5 years ago

copernican commented 5 years ago

Using the example provided in the README, geom_treemap_text() does not appear to create labels for each tile. This appears to have changed in 2.5.1 (labels were working in 2.5.0).

library(ggplot2)
library(treemapify)
ggplot(G20, aes(area = gdp_mil_usd, fill = hdi, label = country)) +
  geom_treemap() +
  geom_treemap_text(fontface = "italic", colour = "white", place = "centre",
                    grow = TRUE)

Created on 2018-10-09 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.5.1 (2018-07-02) #> system x86_64, darwin17.6.0 #> ui unknown #> language (EN) #> collate en_US.UTF-8 #> tz America/New_York #> date 2018-10-09 #> Packages ----------------------------------------------------------------- #> package * version date source #> assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0) #> backports 1.1.2 2017-12-13 CRAN (R 3.5.0) #> base * 3.5.1 2018-07-03 local #> bindr 0.1.1 2018-03-13 CRAN (R 3.5.0) #> bindrcpp 0.2.2 2018-03-29 CRAN (R 3.5.0) #> colorspace 1.3-2 2016-12-14 CRAN (R 3.5.0) #> compiler 3.5.1 2018-07-03 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-03 local #> devtools 1.13.6 2018-06-27 CRAN (R 3.5.0) #> digest 0.6.17 2018-09-12 CRAN (R 3.5.1) #> dplyr 0.7.6 2018-06-29 CRAN (R 3.5.0) #> evaluate 0.11 2018-07-17 CRAN (R 3.5.1) #> ggplot2 * 3.0.0 2018-07-03 CRAN (R 3.5.0) #> glue 1.3.0 2018-07-17 CRAN (R 3.5.1) #> graphics * 3.5.1 2018-07-03 local #> grDevices * 3.5.1 2018-07-03 local #> grid 3.5.1 2018-07-03 local #> gtable 0.2.0 2016-02-26 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.20 2018-02-20 CRAN (R 3.5.0) #> 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-03 local #> mime 0.6 2018-10-05 CRAN (R 3.5.1) #> munsell 0.5.0 2018-06-12 CRAN (R 3.5.0) #> pillar 1.3.0 2018-07-14 CRAN (R 3.5.1) #> pkgconfig 2.0.2 2018-08-16 CRAN (R 3.5.1) #> plyr 1.8.4 2016-06-08 CRAN (R 3.5.0) #> purrr 0.2.5 2018-05-29 CRAN (R 3.5.0) #> R6 2.3.0 2018-10-04 CRAN (R 3.5.1) #> Rcpp 0.12.19 2018-10-01 CRAN (R 3.5.1) #> rlang 0.2.2 2018-08-16 CRAN (R 3.5.1) #> rmarkdown 1.10 2018-06-11 CRAN (R 3.5.0) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0) #> scales 1.0.0 2018-08-09 CRAN (R 3.5.1) #> stats * 3.5.1 2018-07-03 local #> stringi 1.2.4 2018-07-20 CRAN (R 3.5.1) #> stringr 1.3.1 2018-05-10 CRAN (R 3.5.0) #> tibble 1.4.2 2018-01-22 CRAN (R 3.5.0) #> tidyselect 0.2.4 2018-02-26 CRAN (R 3.5.0) #> tools 3.5.1 2018-07-03 local #> treemapify * 2.5.1 2018-10-06 CRAN (R 3.5.1) #> utils * 3.5.1 2018-07-03 local #> withr 2.1.2 2018-03-15 CRAN (R 3.5.0) #> xml2 1.2.0 2018-01-24 CRAN (R 3.5.0) #> yaml 2.2.0 2018-07-25 CRAN (R 3.5.1) ```
copernican commented 5 years ago

For reference, here is the same example with 2.5.0, which I installed with

devtools::install_version(
  "treemapify", version = "2.5.0", repos = "http://cran.us.r-project.org"
)
library(ggplot2)
library(treemapify)
ggplot(G20, aes(area = gdp_mil_usd, fill = hdi, label = country)) +
  geom_treemap() +
  geom_treemap_text(fontface = "italic", colour = "white", place = "centre",
                    grow = TRUE)

Created on 2018-10-09 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.5.1 (2018-07-02) #> system x86_64, darwin17.6.0 #> ui unknown #> language (EN) #> collate en_US.UTF-8 #> tz America/New_York #> date 2018-10-09 #> Packages ----------------------------------------------------------------- #> package * version date source #> assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0) #> backports 1.1.2 2017-12-13 CRAN (R 3.5.0) #> base * 3.5.1 2018-07-03 local #> bindr 0.1.1 2018-03-13 CRAN (R 3.5.0) #> bindrcpp 0.2.2 2018-03-29 CRAN (R 3.5.0) #> colorspace 1.3-2 2016-12-14 CRAN (R 3.5.0) #> compiler 3.5.1 2018-07-03 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-03 local #> devtools 1.13.6 2018-06-27 CRAN (R 3.5.0) #> digest 0.6.17 2018-09-12 CRAN (R 3.5.1) #> dplyr 0.7.6 2018-06-29 CRAN (R 3.5.0) #> evaluate 0.11 2018-07-17 CRAN (R 3.5.1) #> ggfittext 0.6.0 2018-07-06 CRAN (R 3.5.1) #> ggplot2 * 3.0.0 2018-07-03 CRAN (R 3.5.0) #> glue 1.3.0 2018-07-17 CRAN (R 3.5.1) #> graphics * 3.5.1 2018-07-03 local #> grDevices * 3.5.1 2018-07-03 local #> grid 3.5.1 2018-07-03 local #> gtable 0.2.0 2016-02-26 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.20 2018-02-20 CRAN (R 3.5.0) #> 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-03 local #> mime 0.6 2018-10-05 CRAN (R 3.5.1) #> munsell 0.5.0 2018-06-12 CRAN (R 3.5.0) #> pillar 1.3.0 2018-07-14 CRAN (R 3.5.1) #> pkgconfig 2.0.2 2018-08-16 CRAN (R 3.5.1) #> plyr 1.8.4 2016-06-08 CRAN (R 3.5.0) #> purrr 0.2.5 2018-05-29 CRAN (R 3.5.0) #> R6 2.3.0 2018-10-04 CRAN (R 3.5.1) #> Rcpp 0.12.19 2018-10-01 CRAN (R 3.5.1) #> rlang 0.2.2 2018-08-16 CRAN (R 3.5.1) #> rmarkdown 1.10 2018-06-11 CRAN (R 3.5.0) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0) #> scales 1.0.0 2018-08-09 CRAN (R 3.5.1) #> stats * 3.5.1 2018-07-03 local #> stringi 1.2.4 2018-07-20 CRAN (R 3.5.1) #> stringr 1.3.1 2018-05-10 CRAN (R 3.5.0) #> tibble 1.4.2 2018-01-22 CRAN (R 3.5.0) #> tidyselect 0.2.4 2018-02-26 CRAN (R 3.5.0) #> tools 3.5.1 2018-07-03 local #> treemapify * 2.5.0 2018-04-30 url #> utils * 3.5.1 2018-07-03 local #> withr 2.1.2 2018-03-15 CRAN (R 3.5.0) #> xml2 1.2.0 2018-01-24 CRAN (R 3.5.0) #> yaml 2.2.0 2018-07-25 CRAN (R 3.5.1) ```
wilkox commented 5 years ago

@copernican Thanks for picking up this bug and for providing a reprex! I've released a dev version to fix this bug, could you please install it with devtools::install_github('wilkox/treemapify') and confirm that it fixes the issue for you?

copernican commented 5 years ago

Yes, a0daa0e fixes the issue. Thank you for the quick resolution.