Family

Welcome to #30DayChartChallenge 2023 day 16

Networks
Published

April 16, 2023

To cite Federica’s work please use:

Gazzelloni F. (2023), Data Visualization: Family Wordcloud

library(tidyverse)
library(showtext)
library(sysfonts) # this is included in showtext
library(extrafont)
loadfonts()  
fonts()
sysfonts::font_families()
  
library(wordcloud2)
  
  # Define the font families to use
  font_families <- c("Arial", 
                     "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
  df <- data.frame(word = font_families, 
                   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")