Giter Club home page Giter Club logo

emojifont's Introduction

Guangchuang's github stats Top Langs

👋 Hi there!

My name is Guangchuang and I'm a professor in Department of Bioinformatics at Southern Medical University.

emojifont's People

Contributors

ekstroem avatar guangchuangyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

emojifont's Issues

Error: C stack usage 19923552 is too close to the limit Lost warning messages

windows()
require(emojifont)
require(ggplot2)
ggplot() + geom_emoji('cake')
Error: C stack usage 19923088 is too close to the limit Lost warning messages
ggplot() + geom_emoji('christmas_tree')
Error: C stack usage 19923552 is too close to the limit Lost warning messages
######################################################
sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936

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

other attached packages:
[1] yyplot_0.0.5 gridExtra_2.3 ROI_0.3-0 ggplot2_2.2.1
[5] emojifont_0.5.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 compiler_3.4.2 plyr_1.8.4
[4] bindr_0.1 sysfonts_0.7.1 R.methodsS3_1.7.1
[7] R.utils_2.6.0 tools_3.4.2 digest_0.6.12
[10] R.cache_0.12.0 memoise_1.1.0 tibble_1.3.4
[13] gtable_0.2.0 qrcode_0.1.1 pkgconfig_2.0.1
[16] rlang_0.1.4 registry_0.3 magick_1.5
[19] rvcheck_0.0.9 yaml_2.1.14 proto_1.0.0
[22] bindrcpp_0.2 showtextdb_2.0 stringr_1.2.0
[25] xml2_1.1.1 httr_1.3.1 withr_2.1.0
[28] dplyr_0.7.4 knitr_1.17 devtools_1.13.4
[31] RISmed_2.1.7 glue_1.2.0 R6_2.2.2
[34] purrr_0.2.4 tidyr_0.7.2 tweenr_0.1.5
[37] scholar_0.1.4 udunits2_0.13 magrittr_1.5
[40] scales_0.5.0 MASS_7.3-47 units_0.4-6
[43] rsconnect_0.8.5 showtext_0.5 rvest_0.3.2
[46] assertthat_0.2.0 ggforce_0.1.1 colorspace_1.3-2
[49] numDeriv_2016.8-1 labeling_0.3 stringi_1.1.5
[52] lazyeval_0.2.1 munsell_0.4.3 slam_0.1-40
[55] R.oo_1.21.0

Some emojis work, others don't

Hi

Thank you for this package, it looks promising! However, it seems that only some emojis can be displayed, while others don't work at all. Do I need to install other «stuff»?
Thanks for your help!

Here's my sessionInfo:

sessionInfo()

R version 3.2.2 (2015-08-14)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.7 (Final)

 locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
 [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] ggplot2_2.0.0   emojifont_0.3.1 showtext_0.4-4  sysfonts_0.5    RMySQL_0.10.7  
[6] DBI_0.3.1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3      digest_0.6.9     showtextdb_1.0   grid_3.2.2       plyr_1.8.3      
 [6] gtable_0.1.2     scales_0.3.0     proto_0.3-10     labeling_0.3     tools_3.2.2     
[11] munsell_0.4.2    colorspace_1.2-6

Unable to load emojifont

I'm having trouble loading emojifont:

> library(emojifont)
Error: package or namespace load failed for ‘emojifont’:
 .onLoad failed in loadNamespace() for 'sysfonts', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Users/uctqebl/Library/R/3.4/library/sysfonts/libs/sysfonts.so':
  dlopen(/Users/uctqebl/Library/R/3.4/library/sysfonts/libs/sysfonts.so, 6): Library not loaded: /opt/X11/lib/libfreetype.6.dylib
  Referenced from: /Users/uctqebl/Library/R/3.4/library/sysfonts/libs/sysfonts.so
  Reason: image not found

Any idea what might be going on? Here's the sessionInfo:

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.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.4/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] emoGG_0.0.2          emo_0.0.0.9000       abind_1.4-5          rgdal_1.2-8          maptools_0.9-2      
 [6] sp_1.2-5             rgeos_0.3-23         jsonlite_1.5         rstan_2.16.2         StanHeaders_2.16.0-1
[11] ggplot2_2.2.1       

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12     lubridate_1.6.0  lattice_0.20-35  png_0.1-7        assertthat_0.2.0 digest_0.6.12   
 [7] mime_0.5         R6_2.2.2         plyr_1.8.4       stats4_3.4.1     httr_1.3.1       rlang_0.1.2     
[13] lazyeval_0.2.0   curl_2.8.1       rstudioapi_0.7   miniUI_0.1.1     proto_1.0.0      labeling_0.3    
[19] devtools_1.13.3  stringr_1.2.0    foreign_0.8-69   RCurl_1.95-4.8   munsell_0.4.3    shiny_1.0.5     
[25] compiler_3.4.1   httpuv_1.3.5     pkgconfig_2.0.1  htmltools_0.3.6  tibble_1.3.4     gridExtra_2.2.1 
[31] crayon_1.3.4     dplyr_0.7.3      withr_2.0.0      bitops_1.0-6     grid_3.4.1       xtable_1.8-2    
[37] gtable_0.2.0     git2r_0.19.0     magrittr_1.5     scales_0.5.0     stringi_1.1.5    bindrcpp_0.2    
[43] tools_3.4.1      glue_1.1.1       purrr_0.2.3      inline_0.3.14    colorspace_1.3-2 memoise_1.1.0   
[49] knitr_1.17       bindr_0.1   ```

Thanks!

Unable to access solid fontawesome icons

Fontawesome fonts are included but some icons are not available.

For example: fontawesome("fa-fire") works but fontawesome("fa-shoe-prints") does not work (error is Invalid: fa-shoe-prints). Is this just because an older version of font awesome is bundled with package?

How can I use the latest version of font awesome icons?

Does not work on OSX

I cannot get the emojis on my Mac with OSX 10.11.5 and R 3.3.0,
neither in R nor in RStudio.
This is what happens"

library(emojifont)
list.emojifonts()
[1] "OpenSansEmoji.ttf"
load.emojifont('OpenSansEmoji.ttf')
emoji(search_emoji('smile'))
[1] "\U0001f604" "\U0001f603" "\U0001f605" "\U0001f63a" "\U0001f638"

Fontawesome Icons don't appear

Hi

I installed the emojifont package today and I'm using R Version 3.6.1 and I was trying to follow this:
https://stackoverflow.com/questions/47105282/valuebox-like-function-for-static-reports

The fontawesome icons are appearing as squares in the Plots window and in the html document I knit.

I also keep getting this error:
In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database

When I run the code in R Markdown or notebook in line (before knitting), I am able to see the fontawesome icons.

However, after knitting they appear as squares again.

So, the fontawesome icons are appearing as squares in the Plots window and in the html document I knit.

ggplot example not working in rMarkdown

This example

library(emojifont)
dd=data.frame(x=emoji(c("satisfied", "disapointed")), y=c(50, 10))
emoji_text=element_text(family="OpenSansEmoji", size=20)
ggplot(dd, aes(x, y)) + geom_bar(stat='identity', aes(fill=x)) + 
     ggtitle(paste(emoji(c("+1", "-1")), collapse=" "))+ 
        theme(axis.text.x = emoji_text, legend.text=emoji_text, title=emoji_text) + 
            xlab(NULL)+ylab(NULL)

Works in regular r or rstudio desktop

When I take this to rMarkdown it does not work. I am using the rmarkdown template https://raw.githubusercontent.com/GuangchuangYu/emojifont/master/vignettes/emojifont.Rmd

and calling ```{r fig.showtext=TRUE}

No font could be found for family "EmojiOne"

The following results in In grid.Call.graphics(C_text, as.graphicsAnnot(x$label), ... :no font could be found for family "EmojiOne"

df %>% ggplot(aes(x,y) + geom_point() +   geom_text(
    aes(
      x,
      y,
      label = emoji('cow')
   )
)

sessionInfo:
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.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.4/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] emojifont_0.5.0 lubridate_1.6.0 bindrcpp_0.2 okcupiddata_0.1.0 mosaic_1.1.0
[6] Matrix_1.2-11 mosaicData_0.14.0 ggformula_0.6 lattice_0.20-35 broom_0.4.2
[11] stringr_1.2.0 dplyr_0.7.3 purrr_0.2.3 readr_1.1.1 tidyr_0.7.1
[16] tibble_1.3.4 ggplot2_2.2.1 tidyverse_1.1.1

loaded via a namespace (and not attached):
[1] reshape2_1.4.2 splines_3.4.1 haven_1.1.0 colorspace_1.3-2 rlang_0.1.2 foreign_0.8-69
[7] glue_1.1.1 modelr_0.1.1 readxl_1.0.0 bindr_0.1 plyr_1.8.4 mosaicCore_0.4.0
[13] munsell_0.4.3 gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2 psych_1.7.5 labeling_0.3
[19] knitr_1.17 forcats_0.2.0 parallel_3.4.1 proto_1.0.0 Rcpp_0.12.13 scales_0.5.0
[25] showtext_0.4-6 jsonlite_1.5 sysfonts_0.7.1 gridExtra_2.2.1 mnormt_1.5-5 digest_0.6.12
[31] hms_0.3 stringi_1.1.5 showtextdb_2.0 grid_3.4.1 tools_3.4.1 magrittr_1.5
[37] lazyeval_0.2.0 ggdendro_0.1-20 pkgconfig_2.0.1 MASS_7.3-47 xml2_1.1.1 assertthat_0.2.0
[43] httr_1.3.1 R6_2.2.2 nlme_3.1-131 compiler_3.4.1

R session crash when plotting

Hi,
I want to update a blog post using your library emojifont that worked fine a few month ago.
But today, a simple plot crashes my R session.
I am working on Ubuntu 16.04.
Rstudio crashes without message.
With Rkward, there are some hidden warning messages before I plot saying:

1: font family '?VUUUUU?%P?,@�73@' not found, will use 'wqy-microhei' instead
2: UTF-8 decoding error for 'pO
�'

After trying to plot, the session crashes with this error:

Erreur : C stack usage  140735517452172 is too close to the limit

If I only send emoji('evergreen_tree') in the console, it returns the emoji

[1] "🌲"

The problem is the same even when I load the fonts before load.emojifont(font = "EmojiOne.ttf")

I tried installing both ttf directly, but this does not change.
Any idea about what is going wrong ?

Include emojis in Rmarkdown

Hi, I would like to use the package emojifont to include emojis in Rmarkdown. All the examples I have seen involve plotting with plot or ggplot. But I would like to simply include an emoji in the middle in some text.
Thanks!

Problems in interplay with extrafont package

Hi, thank you very much for this great package! I used it for several occasions but this time I wanted not only to include font awesome icons but also customized fonts.

However, I realized that exporting the fonts via ggsave does not work, neither as .pdf nor as .png. This is also true for plots that do not contain any emojis but happens once the package is loaded. Also loading the packages in reverse order (emojifont first, then extrafont) did not fix it.

In case emojifont package via library(emojifont) has been loaded, the plot does not contain any font-adjustments (family, face, ...). In case of saving it as an .png there is also an issue with the base_size as it seems. See the reprex below (note that the fonts are correctly displayed within the Rstudio viewer pane but the problem arises when the plots were saved).

Do you have any idea what's going on here and how to fix it?

library(tidyverse)
library(extrafont)
#> Registering fonts with R

df_nobel <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-05-14/nobel_winners.csv")
#> Parsed with column specification:
#> cols(
#>   prize_year = col_double(),
#>   category = col_character(),
#>   prize = col_character(),
#>   motivation = col_character(),
#>   prize_share = col_character(),
#>   laureate_id = col_double(),
#>   laureate_type = col_character(),
#>   full_name = col_character(),
#>   birth_date = col_date(format = ""),
#>   birth_city = col_character(),
#>   birth_country = col_character(),
#>   gender = col_character(),
#>   organization_name = col_character(),
#>   organization_city = col_character(),
#>   organization_country = col_character(),
#>   death_date = col_date(format = ""),
#>   death_city = col_character(),
#>   death_country = col_character()
#> )

df_nobel_proc <- df_nobel %>% 
  filter(laureate_type == "Individual") %>% 
  group_by(prize_year) %>% 
  mutate(ind_awards = n()) %>%
  group_by(prize_year, gender) %>% 
  count() %>% 
  ungroup() %>% 
  complete(prize_year, gender, fill = list(n = 0))
  
## plot without emojifont loaded
ggplot(df_nobel_proc, aes(prize_year, n, color = gender)) +
  geom_line(alpha = 0.5) + 
  geom_point() +
  theme_light(base_family = "Poppins") +
  theme(axis.text = element_text(family = "Roboto Mono"),
        legend.direction = "horizontal",
        legend.position = "bottom") +
  labs(x = NULL, y = NULL, title = "Nobel Prize Winners by Gender")

ggsave("nobel_font_okay.pdf", width = 9, height = 5, device = cairo_pdf)
ggsave("nobel_font_okay.png", width = 9, height = 5)

saved png: https://i.imgur.com/f6j3nVG.png

## same plot but emojifont loaded
library(emojifont)
#> Warning: Paket 'emojifont' wurde unter R Version 3.5.3 erstellt

ggplot(df_nobel_proc, aes(prize_year, n, color = gender)) +
  geom_line(alpha = 0.5) + 
  geom_point() +
  theme_light(base_family = "Poppins") +
  theme(axis.text = element_text(family = "Roboto Mono"),
        legend.direction = "horizontal",
        legend.position = "bottom") +
  labs(x = NULL, y = NULL, title = "Nobel Prize Winners by Gender")
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

ggsave("nobel_font_not_found.pdf", width = 9, height = 5, device = cairo_pdf)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

ggsave("nobel_font_not_found.png", width = 9, height = 5)
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Roboto Mono' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
#> x$y, : font family 'Poppins' not found, will use 'wqy-microhei' instead
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family 'Poppins' not found, will use 'wqy-microhei' instead

#> ...and so on and on... (shortened redundant output to allow for some readability)

saved png: https://imgur.com/9YlFLOq.png

sessionInfo
#> function (package = NULL) 
#> {
#>     z <- list()
#>     z$R.version <- R.Version()
#>     z$platform <- z$R.version$platform
#>     if (nzchar(.Platform$r_arch)) 
#>         z$platform <- paste(z$platform, .Platform$r_arch, sep = "/")
#>     z$platform <- paste0(z$platform, " (", 8 * .Machine$sizeof.pointer, 
#>         "-bit)")
#>     z$locale <- Sys.getlocale()
#>     if (.Platform$OS.type == "windows") {
#>         z$running <- win.version()
#>     }
#>     else if (nzchar(Sys.which("uname"))) {
#>         uname <- system("uname -a", intern = TRUE)
#>         os <- sub(" .*", "", uname)
#>         z$running <- switch(os, Linux = if (file.exists("/etc/os-release")) {
#>             tmp <- readLines("/etc/os-release")
#>             t2 <- if (any(startsWith(tmp, "PRETTY_NAME="))) sub("^PRETTY_NAME=", 
#>                 "", grep("^PRETTY_NAME=", tmp, value = TRUE)[1L]) else if (any(startsWith(tmp, 
#>                 "NAME"))) sub("^NAME=", "", grep("^NAME=", tmp, 
#>                 value = TRUE)[1L]) else "Linux (unknown distro)"
#>             sub("\"(.*)\"", "\\1", t2)
#>         } else if (file.exists("/etc/system-release")) {
#>             readLines("/etc/system-release")
#>         }, Darwin = {
#>             ver <- readLines("/System/Library/CoreServices/SystemVersion.plist")
#>             ind <- grep("ProductUserVisibleVersion", ver)
#>             ver <- ver[ind + 1L]
#>             ver <- sub(".*<string>", "", ver)
#>             ver <- sub("</string>$", "", ver)
#>             ver1 <- strsplit(ver, ".", fixed = TRUE)[[1L]][2L]
#>             sprintf("%s %s %s", ifelse(as.numeric(ver1) < 12, 
#>                 "OS X", "macOS"), switch(ver1, `6` = "Snow Leopard", 
#>                 `7` = "Lion", `8` = "Mountain Lion", `9` = "Mavericks", 
#>                 `10` = "Yosemite", `11` = "El Capitan", `12` = "Sierra", 
#>                 `13` = "High Sierra", ""), ver)
#>         }, SunOS = {
#>             ver <- system("uname -r", intern = TRUE)
#>             paste("Solaris", strsplit(ver, ".", fixed = TRUE)[[1L]][2L])
#>         }, uname)
#>     }
#>     if (is.null(package)) {
#>         package <- grep("^package:", search(), value = TRUE)
#>         keep <- vapply(package, function(x) x == "package:base" || 
#>             !is.null(attr(as.environment(x), "path")), NA)
#>         package <- .rmpkg(package[keep])
#>     }
#>     pkgDesc <- lapply(package, packageDescription, encoding = NA)
#>     if (length(package) == 0) 
#>         stop("no valid packages were specified")
#>     basePkgs <- sapply(pkgDesc, function(x) !is.null(x$Priority) && 
#>         x$Priority == "base")
#>     z$basePkgs <- package[basePkgs]
#>     if (any(!basePkgs)) {
#>         z$otherPkgs <- pkgDesc[!basePkgs]
#>         names(z$otherPkgs) <- package[!basePkgs]
#>     }
#>     loadedOnly <- loadedNamespaces()
#>     loadedOnly <- loadedOnly[!(loadedOnly %in% package)]
#>     if (length(loadedOnly)) {
#>         names(loadedOnly) <- loadedOnly
#>         pkgDesc <- c(pkgDesc, lapply(loadedOnly, packageDescription))
#>         z$loadedOnly <- pkgDesc[loadedOnly]
#>     }
#>     z$matprod <- as.character(options("matprod"))
#>     es <- extSoftVersion()
#>     z$BLAS <- as.character(es["BLAS"])
#>     z$LAPACK <- La_library()
#>     class(z) <- "sessionInfo"
#>     z
#> }
#> <bytecode: 0x0000000011fa6b38>
#> <environment: namespace:utils>

Created on 2019-05-15 by the reprex package (v0.2.1)

Emojifont problems in 3.4.3

I've been trying emojifont package and doesn't work properly, I put this issue in this question in Stack. Instead of emojis appears white squares when plotting in ggplot and doesn't appear anything with plot() function. All the examples provided in the readme files are not working for me. I try on mac and windows. Where is the problem?

ThanksIA

fa-facebook doesn't render

Neither does any facebook icon (fa-facebook-f, fa-facebook-square, etc). I haven't tried others, but that's one I was looking for. Twitter and LinkedIn icons work fine.

fontawesome() Hyphen Inclusion Reference Issue

Session info -----------------------------------------------------------------------------------------------------
setting value
version R version 3.4.3 (2017-11-30)
system x86_64, mingw32
ui RStudio (1.1.453)
language (EN)
collate English_United States.1252
tz America/New_York
date 2018-09-24

This code runs successfully:

windows()
fa <- fontawesome(rep('fa-github',20))
d <- data.frame(x=rnorm(20),
y=rnorm(20),
label=fa)

ggplot(d, aes(x, y, color=label, label=label)) +
geom_text(family='fontawesome-webfont', size=6)+
xlab(NULL)+ylab(NULL) +
theme(legend.text=element_text(family='fontawesome-webfont'))
#######################################################################
When the argument passed to the fontawesome function includes a hyphen then it does not run. The error occurs with the fontawesome function:

fa <- fontawesome(rep('fa-jedi-order',20))
Invalid: fa-jedi-order, fa-jedi-order,[...]

Only thing changed from first set of code was 'fa-github' >> 'fa-jedi-order'
I've tried variations of removing the second hyphen for an underscore, space, period.

Thanks

font not found

I tried with RStudio on OSX 10.11.2.
It did not work. When running the first example, no emojis are display and I get warnings:

50: no font could be found for family "OpenSansEmoji"

I do notget any errors when I do
load.emojifont('OpenSansEmoji.ttf')
and the font is in the correct place.

RSTudio again.

When opening a png device from the RStudio console, things work.
Knitting also uses the png device, but knitting from Rmd files does not work with emojis.
Is there a way to make it work this way?

One problem remaining

I just ran the examples in an html_notebook in RStudio 1.1.207 on MacOS 10.12.4 and everything works with one exception. The Apple color emoji example using gridSVG only produces black narrow outline rectangles

image 20-04-2017 at 17 35

emojifont impacts use of other fonts in titles and axes

For some reason, ggplot reverts to 'sans' at a very tiny font size when using emojifont. Error message below. Restarting the R session and not loading emojifont solves the problem.

Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
font family 'Quadon' not found, will use 'sans' instead

Skin color in human emoji

Is is possible to change the skin color of the people in the emoji? For example: 👍 and 👍🏾.

I did a quick search and can't seem to find an answer.

OSX and RStudio problem

OK, I did more detailed investigations.
The packages works with the quartz device in OSX.

library(emojifont)
load.emojifont('OpenSansEmoji.ttf')
set.seed(123)
x <- rnorm(10)
set.seed(321)
y <- rnorm(10)
plot(x, y, cex=0)
text(x, y, labels=emoji('cow'), cex=1.5, col='steelblue', family='OpenSansEmoji')

When I try to knit it in RStudio, I get a warning:

Warning in text.default(x, y, labels = emoji("cow"), cex = 1.5, col =
"steelblue", : no font could be found for family "OpenSansEmoji"


When I source R code in RStudio an explicitly use the quartz device, it works,

But with RStudio's own graphics device, it does not work.

Having trouble rendering colour emoji in ggplot2

I'm trying to use the emoji associated with countries in a ggplot2 visualisation. However, the emoji are rendering as the individual country code Unicode sequence components:

steamtrain2012 = ggplot(all_data %>% filter(year == 2012)) +
  geom_pointrange(
    aes(
      x = gdppc,
      ymin = temp_min,
      y = temp,
      ymax = temp_max,
      colour = world_6region)) +
  geom_text(
    aes(
      x = gdppc,
      y = 2.3,
      label = flag_emoji,
      size = co2_cum),
    family = 'EmojiOne') +
  scale_x_log10() +
  scale_y_continuous(limits = c(-2.5, 2.5)) +
  scale_size(range = c(0, 20), guide = FALSE) +
  theme_classic(base_size = 16)

test1

However, the Unicode code points I'm providing appear to be right as far as I can tell:

> emoji('australia')
[1] "\U0001f1e6\U0001f1fa"
> emoji('us')
[1] "\U0001f1fa\U0001f1f8"
> head(all_data$flag_emoji)
[1] "\U0001f1fa\U0001f1ff" "\U0001f1e6\U0001f1f2" "\U0001f1ec\U0001f1ea"
[4] "\U0001f1f0\U0001f1ec" "\U0001f1fb\U0001f1f3" "\U0001f1f9\U0001f1ef"

I've also tried using gganimate to make a video version with the full dataset, as well as a ggplotly version. With gganimate rendering to a GIF or an MP4, I get the same result as with a static ggplot.

With plotly, the flags render correctly as emoji, but they use my system emoji font, not EmojiOne. I understand that this is probably a browser limitation and am looking at whether I can inject some Javascript to do the substitution :/ But it would be nice to get to the bottom of why it isn't working with a static or animated plot!

(Note: I'm running R 3.3.3 on macOS 10.12.6)

use with RMarkdown

Hi, I got a great ggplot2 image to render with Emoji marking the nodes of a network with ggraph. I'm really pleased with it and want to publish up my process with RMarkdown, however, when I get to the first chunk of code with emojifont, it pulls this error:


Quitting from lines 85-89 (fish_pond.Rmd)
Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
invalid input '�' in 'utf8towcs'
Calls: ... drawDetails -> drawDetails.text -> grid.Call.graphics
In addition: There were 13 warnings (use warnings() to see them)

Execution halted


I made sure that the .rmd file was encoding in UTF8, but nevertheless the message persisted. When I removed that line of code, the same error recurred when the emojifont package was next utilized.

Any suggestions?

Thanks!

Andrew

Unable to replicate the example

Hello,

When I try to replicate this example

set.seed(2016-03-09)
fa <- fontawesome(c('fa-github', 'fa-weibo', 'fa-twitter', 'fa-android', 'fa-coffee'))
d <- data.frame(x=rnorm(20),
                y=rnorm(20),
                label=sample(fa, 20, replace=T))

ggplot(d, aes(x, y, color=label, label=label)) +
    geom_text(family='fontawesome-webfont', size=6)+
    xlab(NULL)+ylab(NULL) +
    theme(legend.text=element_text(family='fontawesome-webfont'))

I get the following figure

image

I have downloaded fontawesome from here https://fontawesome.com/download

I also used

extrafont::font_import()
extrafont::loadfonts(device = "win")

Please can you help? Thank you so much! :)

Error: package or namespace load failed for ‘emojifont’

I am using R 3.6.2 // Studio 1.1.383 versions. I am able to install emojifont from the CRAN but not from devtools and whenever I try to load the library I get that error. Have not found a way to fix in in StackOverflow or elsewhere. Is there some sort of compatibility issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.