Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use font awesome in R

I'm trying to use font awesome icons in ggplot, but I can't have them showing. In the plot they just are not present while in console they print as missing character. I tried to use them this way:

> library(emojifont)
> load.fontawesome()
> fontawesome('fa-check-circle')
[1] " "

In ggplot I tried:

geom_text(size = 7, nudge_y = .1, color = 'steelblue', family='fontawesome-webfont')

but it displays nothing.

Font awesome is properly installed on my computer, and it works in microsoft word or other text editors. I'm on MacOS High Sierra.

Thanks

like image 903
Bakaburg Avatar asked Nov 08 '22 15:11

Bakaburg


1 Answers

Here is a solution that might work for you

library(ggplot2)
library(emojifont)
load.fontawesome()

## Generate some data
DF <- data.frame(x=1:5, y=1:5)
ggplot(DF, aes(x=x, y=y)) + 
     geom_text(label=fontawesome('fa-check-circle'), family='fontawesome-webfont')

Here is a slightly more fun version using version 4.7 icons (fa-meetup)

ggplot(DF, aes(x=x, y=y)) + 
     geom_text(label=fontawesome(c('fa-check-circle', 'fa-linux', 'fa-meetup', 'fa-github', 'fa-eur')), 
               family='fontawesome-webfont', 
               size=seq(6, 14, 2))
like image 184
ekstroem Avatar answered Nov 14 '22 20:11

ekstroem