Skip to content
Coming soon: Ally. Your guide to the world of AI and R. Learn More →
R for the Rest of Us Logo

R in 3 Months (Spring 2026)

Week 3 Live Session (Spring 2026)

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

Re-create the plot

Option 1: copy the code from this page on your own R script file using Positron or RStudio

Option 2: play on this webpage interactively (the data and packages are already loaded)

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Alberto Cabrera

Alberto Cabrera • March 27, 2026

I was intrigued by why David did not use geom_label() for his Data Viz Class Exercise. It took me a while to figure out that geom_text() requires less code. After much trial and error, I was able to replicate the figure using geom_label() after learning to request show.legend = FALSE, and declaring linewidth = 0. See below:

median_income_yamhill |> ggplot( aes(x = amount, y = geography, label = amount_formatted, fill = geography) ) + geom_col(show.legend = FALSE) + geom_label( aes(x = 10000, label = geography), color = "white", linewidth = 0, show.legend = FALSE ) + geom_label( aes(label = amount_formatted), hjust = 1.1, color = 'white', linewidth = 0, show.legend = FALSE ) + scale_fill_manual(values = c("Yamhill" = "darkgreen", "Oregon" = 'gray')) + labs(x = NULL, y = NULL) + theme_void()

Course Content

148 Lessons