Recreating Figures with Tidyverse in R
A livestream tutorial on recreating complex scientific figures containing numerous data points using R.
YouTube · Riffomonas Project · 4 November 2026 Watch on YouTube
Tried this idea? Show how yours turned out.
I made thisHow to do it
What you need
- R and RStudio
- tidyverse
- readxl
- patchwork
- ggtext
- glue
- the article's source data file
Step by step
- Install and load the tidyverse, readxl, patchwork, ggtext and glue packages.
- Download and read the data file with download.file and read_excel.
- Select the relevant columns and reshape them with pivot_longer.
- Plot the paired frequencies with geom_point, geom_hex or geom_density on log-scaled axes.
- Add reference lines with geom_abline and label key points with geom_text.
- Split the figure into panels with facet_wrap, then compose the main plot and margins with plot_layout and plot_spacer.
- Style the figure with theme_classic, element_line, element_blank and element_markdown.
- Export the finished figure with ggsave.
Tips
- The video's point is to show all the data — a hex or density plot reveals the full distribution that a summary scatter hides.
- Keep axes on a log scale with scale_x_continuous and scale_y_continuous so the spread across orders of magnitude stays readable.
- Use the axis rug or marginal histogram to show where points pile up outside the plotting area.
Written by Tagrazzi from the original's description and photo.
The title and summary are written by Tagrazzi; the video belongs to its creator and plays from YouTube.
Comments (0)
No comments yet. Be the first to comment.
Sign in to write a comment.