The geom_pictogram() function allows you to create isotype pictograms where squares are replaced by glyphs (like Font Awesome icons).
Key features:
- Use
scale_label_pictogram() to map Font Awesome glyph names to your data labels. - Use
make_proportional = TRUE to adjust the grid based on values. - Use
family to specify the Font Awesome font family (e.g., "FontAwesome5Brands-Regular").
Example:
# Requires Font Awesome fonts to be installed
library(waffle)
library(ggplot2)
xdf %>%
count(parts, wt = vals) %>%
ggplot(
aes(label = parts, values = n)
) +
geom_pictogram(
n_rows = 10,
aes(colour = parts),
flip = TRUE,
make_proportional = TRUE
) +
scale_label_pictogram(
name = NULL,
values = c("apple-alt", "bread-slice", "pizza-slice"),
labels = c("Fruit", "Sammich", "Pizza")
)
xdf %>%
count(parts, wt = vals) %>%
ggplot(
aes(label = parts, values = n)
) +
geom_pictogram(
n_rows = 10,
aes(colour = parts),
flip = TRUE,
make_proportional = TRUE
) +
scale_color_manual(
name = NULL,
values = c("#a40000", "#c68958", "#ae6056"),
labels = c("Fruit", "Sammich", "Pizza")
) +
scale_label_pictogram(
name = NULL,
values = c("apple-alt", "bread-slice", "pizza-slice"),
labels = c("Fruit", "Sammich", "Pizza")
) +
coord_equal() +
theme_ipsum_rc(grid="") +
theme_enhance_waffle()