Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add text annotations to word cloud geom? #23

Open
janstrauss1 opened this issue Jun 12, 2024 · 1 comment
Open

How to add text annotations to word cloud geom? #23

janstrauss1 opened this issue Jun 12, 2024 · 1 comment

Comments

@janstrauss1
Copy link

Hi @lepennec,

many thanks again for this great package!

I'd like to use ggwordcloud to plot a word cloud with a custom shape which I'd now like to annotate with custom text (e. g. using geom_textbox or annotate) as done in this blog post.

However, I'm currently not clear how the word cloud geom is placed in the coordinate system and how to properly add the text annotations at specific positions?

Many thanks in advance for your help!

@lepennec
Copy link
Owner

Dear Jan,
by default, everything is organized around (.5,5) so that something similar to

set.seed(42)
ggplot(love_words_small, aes(label = word, size = speakers)) +
  geom_text_wordcloud() +
  scale_size_area(max_size = 30) +
  annotate(geom="label", x=.5, y=.5, label="Test", size=8, fill="red") +
  theme_void()

may work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants