1

I have installed fontawesome ttfs onto my local machine and loaded them into R. When I test this using fonts()[grep("Awesome", fonts())] it returns "FontAwesome" as expected.

I can run a waffle chart with certain glyphs... so far male, female, and briefcase have worked, but not others, such as "building."

Any idea what's going on?

library(ggplot2)
library(fontawesome)
library(extrafont)
library(waffle)

# This works fine
waffle(
  c(`Poor=10` =10, `Average=18` = 18, `Excellent=7` =7), rows = 5, colors = c("#FD6F6F", "#93FB98", "#D5D9DD"),
  use_glyph = "female", glyph_size = 12 ,title = 'Girls Performance', legend_pos="bottom"
)

# This does not work
waffle(
  c(`Poor=10` =10, `Average=18` = 18, `Excellent=7` =7), rows = 5, colors = c("#FD6F6F", "#93FB98", "#D5D9DD"),
  use_glyph = "building", glyph_size = 12 ,title = 'Girls Performance', legend_pos="bottom"
)
zx8754
  • 52,746
  • 12
  • 114
  • 209
Lstar
  • 56
  • 6

1 Answers1

1

Not sure exactly why it is happening for some glyphs but not others, but I ran across the same issue recently. Found an excellent how-to here: https://www.listendata.com/2019/06/create-infographics-with-r.html

It sounds like you already have fonts available so could skip the first part of the how-to, and that you may just be missing packages. You'll want to add two others: echarts4r (on CRAN) and echarts4r.assets (on github only as of now)

require(devtools)
devtools::install_github("JohnCoene/echarts4r.assets")
library(tidyverse)
library(waffle)
library(extrafont)
library(echarts4r.assets)
library(echarts4r)

# Works for me with all of these packages loaded
waffle(
  c(`Poor=10` =10, `Average=18` = 18, `Excellent=7` =7), rows = 5, colors = c("#FD6F6F", "#93FB98", "#D5D9DD"),
  use_glyph = "building", glyph_size = 12 ,title = 'Girls Performance', legend_pos="bottom"
)
Jonni
  • 804
  • 5
  • 16