ggwordcloud icon indicating copy to clipboard operation
ggwordcloud copied to clipboard

Mask plots not reproducible

Open tsen19 opened this issue 4 years ago • 8 comments

Hello, I was playing around with your package and came across a problem when trying to use a mask. At first I thought it was something with my image but I tried re-producing the example in the vignette using the languages dataset and the heart shape. I basically copy-pasted the code and it just results in blank space. I tried waiting but even after about 20 minutes it was just blank square. Everything else in the vignette works - shapes (start, triangle, etc.), faceting, and coloring. Do you happen to have an idea what could be causing the mask issues? I saw another mask issue that was closed last year but could not find any details or explanations in the thread. Provided at the end is the output of my SessionInfo(). Thanks for the amazing package!

R version 3.6.1 (2019-07-05) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] png_0.1-7 stringr_1.4.0 lubridate_1.7.4 rio_0.5.16 dplyr_0.8.3
[6] wordcloud2_0.2.2 hwordcloud_0.1.0 ggwordcloud_0.5.0.9000 ggplot2_3.2.1

loaded via a namespace (and not attached): [1] tidyselect_0.2.5 remotes_2.1.1 purrr_0.3.3 haven_2.2.0 vctrs_0.2.0 colorspace_1.4-1 [7] testthat_2.3.2 usethis_1.6.1 htmltools_0.4.0 yaml_2.2.0 rlang_0.4.6 pkgbuild_1.0.6
[13] pillar_1.4.2 foreign_0.8-72 glue_1.4.1 withr_2.1.2 readxl_1.3.1 sessioninfo_1.1.1 [19] cellranger_1.1.0 munsell_0.5.0 gtable_0.3.0 zip_2.0.4 devtools_2.3.0 htmlwidgets_1.5.1 [25] memoise_1.1.0 forcats_0.4.0 labeling_0.3 callr_3.4.3 ps_1.3.0 curl_4.2
[31] fansi_0.4.0 Rcpp_1.0.3 scales_1.0.0 backports_1.1.5 desc_1.2.0 pkgload_1.0.2
[37] jsonlite_1.6.1 fs_1.3.1 hms_0.5.2 digest_0.6.25 stringi_1.4.3 openxlsx_4.1.3
[43] processx_3.4.1 grid_3.6.1 rprojroot_1.3-2 cli_2.0.2 tools_3.6.1 magrittr_1.5
[49] lazyeval_0.2.2 tibble_2.1.3 zeallot_0.1.0 crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.0
[55] data.table_1.12.6 prettyunits_1.0.2 assertthat_0.2.1 rstudioapi_0.11 R6_2.4.0 compiler_3.6.1
[61] git2r_0.26.1

tsen19 avatar Jul 13 '20 12:07 tsen19

I'm away from my computer. I will look at this issue when I will be back. Can you give me the OS you are using ?

Le lun. 13 juil. 2020 14:39, tsen19 [email protected] a écrit :

Hello, I was playing around with your package and came across a problem when trying to use a mask. At first I thought it was something with my image but I tried re-producing the example in the vignette using the languages dataset and the heart shape. I basically copy-pasted the code and it just results in blank space. I tried waiting but even after about 20 minutes it was just blank square. Everything else in the vignette works - shapes (start, triangle, etc.), faceting, and coloring. Do you happen to have an idea what could be causing the mask issues? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lepennec/ggwordcloud/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BD2INURWWWHDZY62F5W3R3L6BRANCNFSM4OYOECTQ .

lepennec avatar Jul 13 '20 12:07 lepennec

Oh thanks for the quickest reply! I was editing my initial post just as you posted it. I added all the details from the session info!

tsen19 avatar Jul 13 '20 12:07 tsen19

Sorry for the delay. The following code:

set.seed(42)
ggplot(love_words_small, aes(label = word, size = speakers)) +
  geom_text_wordcloud_area(
    mask = png::readPNG(system.file("extdata/hearth.png",
      package = "ggwordcloud", mustWork = TRUE
    )),
    rm_outside = TRUE
  ) +
  scale_size_area(max_size = 40) +
  theme_minimal()

works for me... Can you send me the exact code you have used?

lepennec avatar Jul 24 '20 10:07 lepennec

Hi Erwan, thanks for getting back to me and looking into it! I was using the exact same code and it was not working. Tried again right now and worked like a charm.. No idea why. Thanks for the super cool package!

tsen19 avatar Jul 24 '20 10:07 tsen19

That's the charm of computer science!

On Fri, Jul 24, 2020 at 12:13 PM tsen19 [email protected] wrote:

Hi Erwan, thanks for getting back to me and looking into it! I was using the exact same code and it was not working. Tried again right now and worked like a charm.. No idea why. Thanks for the super cool package!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lepennec/ggwordcloud/issues/12#issuecomment-663468447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BD2OXV26G7RHLDTZBTLDR5FNFZANCNFSM4OYOECTQ .

lepennec avatar Jul 24 '20 14:07 lepennec

Just wanted to leave a note that I also am running into an issue reproducing that example. In my case I get a blank output in Rstudio. I tried opening and closing Rstudio and still am having the same issue. Do you have any suggestions? Are there prereq packages I can manually try to download or something? Also of note I tried wordcloud2 and was unable to do a masked wordcloud there either. Screen Shot 2020-09-28 at 4 25 46 PM

RStudio information :

RStudio
Version 1.3.1093
© 2009-2020 RStudio, PBC
"Apricot Nasturtium" (aee44535, 2020-09-17) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

R information:

> version
               _                           
platform       x86_64-apple-darwin17.0     
arch           x86_64                      
os             darwin17.0                  
system         x86_64, darwin17.0          
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again 

Session Info:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tidytext_0.2.6    ggwordcloud_0.5.0 lubridate_1.7.9   forcats_0.5.0     stringr_1.4.0    
 [6] dplyr_1.0.2       purrr_0.3.4       readr_1.3.1       tidyr_1.1.2       tibble_3.0.3     
[11] ggplot2_3.3.2     tidyverse_1.3.0   wordcloud2_0.2.1 

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0  xfun_0.17         haven_2.3.1       lattice_0.20-41   colorspace_1.4-1 
 [6] vctrs_0.3.4       generics_0.0.2    SnowballC_0.7.0   htmltools_0.5.0   yaml_2.2.1       
[11] base64enc_0.1-3   blob_1.2.1        rlang_0.4.7       pillar_1.4.6      withr_2.3.0      
[16] glue_1.4.2        DBI_1.1.0         dbplyr_1.4.4      modelr_0.1.8      readxl_1.3.1     
[21] lifecycle_0.2.0   munsell_0.5.0     gtable_0.3.0      cellranger_1.1.0  rvest_0.3.6      
[26] htmlwidgets_1.5.1 labeling_0.3      knitr_1.30        curl_4.3          fansi_0.4.1      
[31] tokenizers_0.2.1  broom_0.7.0       Rcpp_1.0.5        backports_1.1.10  scales_1.1.1     
[36] jsonlite_1.7.1    farver_2.0.3      fs_1.5.0          hms_0.5.3         png_0.1-7        
[41] digest_0.6.25     stringi_1.5.3     grid_4.0.2        cli_2.0.2         tools_4.0.2      
[46] magrittr_1.5      janeaustenr_0.1.5 crayon_1.3.4      pkgconfig_2.0.3   ellipsis_0.3.1   
[51] Matrix_1.2-18     xml2_1.3.2        reprex_0.3.0      assertthat_0.2.1  httr_1.4.2       
[56] rstudioapi_0.11   R6_2.4.1          compiler_4.0.2   

hunterkempf avatar Sep 28 '20 21:09 hunterkempf

I have the same problem. Also running MacOS. I tried the example on Linux, where it seems to work as expected. So it's probably a platform specific issue.

MaxKman avatar Oct 27 '20 08:10 MaxKman

My bet is something related to the graphical device. As soon as I can, I will try to see if ragg solves this issue.

On Tue, Oct 27, 2020 at 9:28 AM MaxKman [email protected] wrote:

I have the same problem. Also running MacOS. I tried the example on Linux, where it seems to work as expected. So it's probably a platform specific issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lepennec/ggwordcloud/issues/12#issuecomment-717074786, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4BD2KDIHFMIDKIEUNSX2DSM2ADTANCNFSM4OYOECTQ .

lepennec avatar Oct 27 '20 15:10 lepennec