2

I'm trying to make a square pie with waffle function but the male icon can't be used

that's what I get using the code below

library(waffle) 
library(extrafont) 
parts <- c(`Sick=14` =14, `Treated=19` = 19, `Not sick=7` =7)

loadfonts(device = "win")
system.file("fonts", package="waffle")
waffle(
   parts, rows = 5, colors = c("#FD6F6F", "#93FB98", "#D5D9DD"),
   use_glyph = "male", size = 8 ,title = 'convenient title'
    )

Thank you .

Marcus Campbell
  • 2,746
  • 4
  • 22
  • 36
  • I'm not sure if this is the same issue but this might help: https://github.com/hrbrmstr/waffle/issues/42 – Amanda Jul 25 '18 at 00:17

2 Answers2

0

This is most likely to a funky installation of Font Awesome. There are many version with various names around. Check that you have "FontAwesome" installed with the following command:

> fonts()[grep("Awesome", fonts())]

[1] "FontAwesome"          

then you should be able to get this:

convenient plot

Roman
  • 4,744
  • 2
  • 16
  • 58
0

What worked for me was following all these instructions (https://www.listendata.com/2019/06/create-infographics-with-r.html) BUT installing the FontAwesome package 4.7 that you can download here (https://fontawesome.com/versions). Otherwise I think it seems newer packages have a different font/family name (Free Reegular version whatever) that waffle can not read.

I would say main points are:

  • Add FontAwesome 4.7. font (.ttf) to your computer clicking on the .ttf file in the package once unzipped.
  • Make sure you remove other versions of FontAwesome from your computer and from the fonttable of extrafont (https://stackoverflow.com/a/70386036/4438465)
  • Make sure you also add the font with the font_add option in showtext package (see step 7 in the first link from listendata).
Juan C
  • 301
  • 1
  • 11