Get access to all lessons in this course.
-
The shape of data
- Chart types
- How to choose a chart
- Visual metaphor
- Memorability vs. speed of comprehension
- Identifying your audience
- Data encoding process
-
Layout
- Grids, borders, lines
- Axes
- Grids, borders, lines, and axes examples and exercises
- Alignment
- White space
- Charts in larger layouts
- Alignment, white space, and layout of multiple plots examples and exercises
-
Typography
- What is typography and why does it matter?
- Typographic hierarchy
- Font styles
- Good fonts and where to find them
- Using custom fonts in R examples and exercises
- ggtext examples and exercises
- Pairing fonts
- Typography beyond charts
-
Color
- Color palettes
- Color examples and exercises
- Color models
- HCL color palettes in ggplot examples and exercises
- The color wheel
- Color and emotion
- The eyedropper tool and color inspiration
-
Special topics
- Legends
- Accessibility
- Combining ggplot with a vector editor
- Annotations
- Resizing plots for export
- Finding inspiration
The Glamour of Graphics
ggtext examples and exercises
This lesson is locked
This lesson is called ggtext examples and exercises, part of the The Glamour of Graphics course. This lesson is called ggtext examples and exercises, part of the The Glamour of Graphics course.
If the video is not playing correctly, you can watch it in a new window
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Your Turn
Adjust the code below, using ggtext
to make the word ‘plastic’ bold in the title and wrapping the subtitle so it is multi-line.
library(tidyverse)
library(ggtext)
##Your turn
#Use ggtext to make the word 'plastic' bold in the title
#and wrap the subtitle so it is multi-line
plastics <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-01-26/plastics.csv')
plastics %>%
group_by(year) %>%
summarize(total = sum(grand_total, na.rm = TRUE)) %>%
ggplot() +
geom_bar(aes(x = "", y = total, fill = as.character(year)), stat = "identity", width = 1) +
coord_polar("y", start = 0) +
theme_minimal() +
labs(title = "Plastic pollution, by year", fill = "",
subtitle = "This is a really really really long subtitle that has tons of detail about your methods and data and even more info beyond that") +
theme(axis.title = element_blank(), panel.grid = element_blank(),
axis.text = element_blank())
You need to be signed-in to comment on this post. Login.
Deepak Varughese
January 29, 2023
Can i not use the same approach to create a multiline subtitle for a combination of plots using patchwork? It throws the following error
"Error: gridtext has encountered a tag that isn't supported yet: Only a very limited number of tags are currently supported. "