icons
icons copied to clipboard
Improve icons integration with {ggwordcloud}
Using icons as masks for a word cloud is pretty cool. Currently you need to use rsvg::rsvg()
to format the icons appropriately for the mask
argument of ggwordcloud::geom_text_wordcloud_area()
. Some simpler function would be nice for this:
library(ggwordcloud)
#> Loading required package: ggplot2
set.seed(42)
ggplot(
love_words,
aes(
label = word, size = speakers,
color = speakers
)
) +
geom_text_wordcloud_area(
mask = rsvg::rsvg(charToRaw(format(icons::fontawesome$solid$hourglass))),
rm_outside = TRUE
) +
scale_size_area(max_size = 40) +
theme_minimal() +
scale_color_gradient(low = "darkred", high = "red")
#> Some words could not fit on page. They have been removed.
Created on 2021-03-12 by the reprex package (v0.3.0)