Lecture 25
Cornell University
INFO 5001 - Fall 2025
December 2, 2025
It adds contrast! Some people just don’t like it 🤷🏽
Image credit: palmerpenguins
Image credit: palmerpenguins


library(gapminder)
gapminder_07 <- filter(.data = gapminder, year == 2007)
p_hist <- ggplot(data = gapminder_07, mapping = aes(x = lifeExp)) +
geom_histogram(binwidth = 2, color = "white")
p_box <- ggplot(
data = gapminder_07,
mapping = aes(x = continent, y = lifeExp)
) +
geom_boxplot()
p_scatter <- ggplot(
data = gapminder_07,
mapping = aes(x = gdpPercap, y = lifeExp)
) +
geom_point()
p_text <- gapminder_07 |>
filter(continent == "Americas") |>
ggplot(mapping = aes(x = gdpPercap, y = lifeExp)) +
geom_text_repel(mapping = aes(label = country)) +
coord_cartesian(clip = "off")The plot will fill the empty space in the slide.
If there is more text on the slide
The plot will shrink
To make room for the text
fig-widthFor a zoomed-in look
fig-widthFor a zoomed-out look
fig-width affects text size

First, ask yourself, must you include multiple plots on a slide? For example, is your narrative about comparing results from two plots?
If no, then don’t! Move the second plot to to the next slide!
If yes:
Insert columns using the Insert anything tool
Use layout - ncol chunk option
Use the {patchwork} package
Possibly, use pivoting to reshape your data and then use facets
Insert > Slide Columns
Quarto will automatically resize your plots to fit side-by-side.


layout-ncol



Learn more at https://patchwork.data-imaginist.com.