library(tidyverse)
library(showtext)
library(sysfonts) # this is included in showtext
library(extrafont)
loadfonts()
fonts()
::font_families()
sysfonts
library(wordcloud2)
# Define the font families to use
<- c("Arial",
font_families "Times New Roman",
"Courier New",
"Verdana",
"Georgia",
"Helvetica",
"Comic Sans MS",
"Impact",
"Tahoma",
"Trebuchet MS",
"Lucida Console",
"Palatino Linotype",
"Book Antiqua",
"Calibri",
"Cambria",
"sans",
"serif",
"mono",
"wqy-microhei",
"Pacifico",
"Schoolbell",
"Dongle",
"MedievalSharp")
# Create a data frame with the font family names
<- data.frame(word = font_families,
df freq = rnorm(23))
# Create the wordcloud with the font families as labels
set.seed(1234)
wordcloud2(df,
fontFamily = font_families,
size = 1.5,
rotateRatio = 0.05,
shape = "circle",
color = "random-light", backgroundColor = "grey")
To cite Federica’s work please use:
Gazzelloni F. (2023), Data Visualization: Family Wordcloud