GuangchuangYu / emojifont

:lollipop:Emoji and fontawesom in both base and ggplot2 graphics
https://guangchuangyu.github.io/emojifont/
67 stars 22 forks source link

use with RMarkdown #17

Closed McCartneyAC closed 6 years ago

McCartneyAC commented 6 years ago

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

GuangchuangYu commented 6 years ago

If you want to use it in rmd, pls follow example on https://raw.githubusercontent.com/GuangchuangYu/emojifont/master/vignettes/emojifont.Rmd and use {r fig.showtext=TRUE}