How to add text to a figure using the R ggplot2 package with geom_text (CC149)
Автор: Riffomonas Project
Загружено: 27 сент. 2021 г.
Просмотров: 2 894 просмотра
Adding text labels to your figure to tell your audience what group each point or line comes from. Thankfully, it's relatively easy to pull this off in R using ggplot2's geom_text function. We'll replace our legend with text annotations and talk about how we can make the labels easier to see. Along the way, we'll also learn about the modulus operator (%%) and get to see if_else and case_when in action. The data depict the percentage of people in 15 countries who would be willing to receive the COVID-19 vaccine as of August and October of 2020.
Pat uses the #geom_text function function from #ggplot2 and a variety of functions from the #dplyr, showtext, and ggtext packages in #RStudio. The accompanying blog post can be found at https://www.riffomonas.org/code_club/....
Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.
R: https://r-project.org
RStudio: https://rstudio.com
Workshops: https://www.mothur.org/wiki/workshops
Here's a link for the chartr newsletter: https://www.chartr.co
If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/
You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/
0:00 Replacing legends with text labels
1:44 Review of manipulating appearance of text
6:34 Placing text annotation within figure
8:16 Pruning the number of country names
13:07 Justification of text annotations
14:48 Adjusting position of text annotations
17:09 Critique of figure

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: