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

geom_text_contour isn't showing labels #139

Closed
symbalex opened this issue Feb 18, 2021 · 5 comments
Closed

geom_text_contour isn't showing labels #139

symbalex opened this issue Feb 18, 2021 · 5 comments

Comments

@symbalex
Copy link

Hi, when I follow the example in ?geom_text_contour

library(ggplot2)
library(metR)

v <- reshape2::melt(volcano)
g <- ggplot(v, aes(Var1, Var2)) +
  geom_contour(aes(z = value))
g + geom_text_contour(aes(z = value))

I get the following warning messages and the plot doesn't display any contour labels. Possibly related to #138 but I can't read it!

Warning: namespace ‘cachem’ is not available and has been replaced
by .GlobalEnv when processing object ‘<unknown>’
Warning message:
Computation failed in `stat_text_contour()`:
could not find function "validate_key" 

I have the most up-to-date versions of metR and ggplot2.

> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_AU.UTF-8                 
 ctype    en_AU.UTF-8                 
 tz       Australia/Melbourne         
 date     2021-02-19                  

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 askpass       1.1     2019-01-13 [1] CRAN (R 4.0.2)
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.2)
 backports     1.2.1   2020-12-09 [1] CRAN (R 4.0.2)
 callr         3.5.1   2020-10-13 [1] CRAN (R 4.0.2)
 checkmate     2.0.0   2020-02-06 [1] CRAN (R 4.0.2)
 cli           2.3.0   2021-01-31 [1] CRAN (R 4.0.2)
 colorspace    2.0-0   2020-11-11 [1] CRAN (R 4.0.2)
 crayon        1.4.1   2021-02-08 [1] CRAN (R 4.0.2)
 curl          4.3     2019-12-02 [1] CRAN (R 4.0.1)
 data.table    1.13.6  2020-12-30 [1] CRAN (R 4.0.2)
 desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.2)
 devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.2)
 digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.2)
 dplyr         1.0.4   2021-02-02 [1] CRAN (R 4.0.2)
 ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.2)
 farver        2.0.3   2020-01-16 [1] CRAN (R 4.0.2)
 fastmap       1.0.1   2019-10-08 [1] CRAN (R 4.0.2)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.2)
 generics      0.1.0   2020-10-31 [1] CRAN (R 4.0.2)
 ggplot2     * 3.3.3   2020-12-30 [1] CRAN (R 4.0.2)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.2)
 gtable        0.3.0   2019-03-25 [1] CRAN (R 4.0.2)
 isoband       0.2.3   2020-12-01 [1] CRAN (R 4.0.2)
 jsonlite      1.7.2   2020-12-09 [1] CRAN (R 4.0.2)
 labeling      0.4.2   2020-10-20 [1] CRAN (R 4.0.2)
 lifecycle     1.0.0   2021-02-15 [1] CRAN (R 4.0.2)
 lubridate     1.7.9.2 2020-11-13 [1] CRAN (R 4.0.2)
 magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.0.2)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.2)
 metR        * 0.9.1   2021-02-07 [1] CRAN (R 4.0.2)
 munsell       0.5.0   2018-06-12 [1] CRAN (R 4.0.2)
 openssl       1.4.3   2020-09-18 [1] CRAN (R 4.0.2)
 pillar        1.4.7   2020-11-20 [1] CRAN (R 4.0.2)
 pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 4.0.2)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.2)
 pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.2)
 plyr          1.8.6   2020-03-03 [1] CRAN (R 4.0.2)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.2)
 processx      3.4.5   2020-11-30 [1] CRAN (R 4.0.2)
 ps            1.5.0   2020-12-05 [1] CRAN (R 4.0.2)
 purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.2)
 R6            2.5.0   2020-10-28 [1] CRAN (R 4.0.2)
 Rcpp          1.0.6   2021-01-15 [1] CRAN (R 4.0.2)
 remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.2)
 reshape2      1.4.4   2020-04-09 [1] CRAN (R 4.0.2)
 rlang         0.4.10  2020-12-30 [1] CRAN (R 4.0.2)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.0.2)
 scales        1.1.1   2020-05-11 [1] CRAN (R 4.0.2)
 secret        1.1.0   2020-05-07 [1] CRAN (R 4.0.2)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.2)
 stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.2)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.2)
 testthat      3.0.2   2021-02-14 [1] CRAN (R 4.0.2)
 tibble        3.0.6   2021-01-29 [1] CRAN (R 4.0.2)
 tidyselect    1.1.0   2020-05-11 [1] CRAN (R 4.0.2)
 usethis       2.0.0   2020-12-10 [1] CRAN (R 4.0.2)
 vctrs         0.3.6   2020-12-17 [1] CRAN (R 4.0.2)
 withr         2.4.1   2021-01-26 [1] CRAN (R 4.0.2)
@eliocamp
Copy link
Owner

eliocamp commented Feb 19, 2021

This is the relevant comment: #137 (comment)

Try reinstalling rlang.

@symbalex
Copy link
Author

I restarted my R session and reinstalled rlang (and restarted again to be safe, and also reinstalled ggplot2 and metR to be double safe) but I still have the same issue.

Would you like me to try dev metR or should CRAN be OK?

@eliocamp
Copy link
Owner

I cannot reproduce this issue using the CRAN version. It still seems like an installation issue with some other package. Perhaps try updating all your packages. If you are on windows bear in mind some of the common problems when updating packages and follow these steps: rstats-wtf/what-they-forgot#62 (comment)

@symbalex
Copy link
Author

I think you're right. I tried it on my linux box and had no issue. Thanks for helping me

@mattbk
Copy link

mattbk commented Feb 17, 2022

In case someone has a similar issue without this error, I found that with some contours based on 204 points, I had to use label.placer = label_placer_n(1) to make labels appear.

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