I had two doubts to customize my wordcloud. The first was how to change the ggwordcloud fonts. The second was whether in data sets with groups, whether it would be possible to suppress the word length caption. I wanted something like:
I wrote to @lepennec , who asked me to post my problem here. He gave me one advice for changing the font that makes me realize where to use the family parameter. Later, I found the solution for the second problem. So, I decided to post my code here to help others and to check with the developers if it's an appropriate solution.
The example uses the same love words data set, grouping the languages in families. Here is the code:
library(ggwordcloud)
library(dplyr)
library('ISOcodes') # To find the font families we use the ISOcodes package
# Changing to the same ID of 'love words'
## Maybe it's not correct, but it's just an example
ISO_3 <- ISO_639_3 %>% select(Id, Family)
ISO_2 <- ISO_639_2 %>% select(Alpha_3_B, Alpha_2)
# Love words - merge to ISO
data("love_words")
dataWord <- merge(love_words_small, ISO_2, by.x="lang", by.y = "Alpha_2")
dataWord <- merge(dataWord, ISO_3, by.x="Alpha_3_B", by.y = "Id")
ggplot(dataWord, aes(label = word, x=Family, size = speakers, colour=Family)) +
geom_text_wordcloud_area(show.legend = TRUE, family="Purisa") +
scale_size_area(max_size = 24) +
scale_x_discrete(breaks = NULL) +
theme_minimal()+ guides(size = FALSE)
My solution was to provide both 'show.legend = TRUE' and 'family="Purisa"' in _geom_text_wordcloudarea. To suppress the size legend, I used 'guides(size = FALSE)' from ggplot2.
Sorry for the naivety, but I was wrongly trying to change the parameters directly in the ggplot functions.
Hello,
I had two doubts to customize my wordcloud. The first was how to change the ggwordcloud fonts. The second was whether in data sets with groups, whether it would be possible to suppress the word length caption. I wanted something like:
I wrote to @lepennec , who asked me to post my problem here. He gave me one advice for changing the font that makes me realize where to use the family parameter. Later, I found the solution for the second problem. So, I decided to post my code here to help others and to check with the developers if it's an appropriate solution.
The example uses the same love words data set, grouping the languages in families. Here is the code:
My solution was to provide both 'show.legend = TRUE' and 'family="Purisa"' in _geom_text_wordcloudarea. To suppress the size legend, I used 'guides(size = FALSE)' from ggplot2.
Sorry for the naivety, but I was wrongly trying to change the parameters directly in the ggplot functions.
Thank you.