Skip to content
R for the Rest of Us: A Statistics-Free Introduction is out now! Check it out →
R for the Rest of Us Logo

Grids, borders, lines, and axes examples and exercises

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window


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

Start with the code below. Then, apply the principles you have learned about for axes, grids, borders, etc to a plot you have made. The code below also has a starting plot for you if you prefer to use that.

##Your turn

#plastic pollution dataset
plastics <- readr::read_csv('')

#Take a plot you made with the plastic pollution dataset (it doesn't need to be a scatter plot)
#And apply the principles you learned about for axes, grids, borders, etc. 
#If you don't want to use your own plot, you can use this one...

#wrangle data
data <- plastics %>%
  group_by(parent_company) %>%
  summarize(total = sum(grand_total, na.rm = TRUE)) %>%
  arrange(desc(total)) %>%
  slice(4:14) %>%
  mutate(parent_company = ifelse(parent_company == "NULL", "Unknown", 
#example starting plot
ggplot(data) +
  geom_col(aes(x = total, y = reorder(parent_company, total)), fill = "orchid4")

#now apply your styling of the grids, axes, borders, and backgrounds

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

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

Blayne Beacham

Blayne Beacham

February 21, 2023

Hey Will,

I really like the "g" and "mm" trick for the labelling of the x and y axes but I'm wondering if it is possible to just label the first (or last) instance of this and let the others be just the numbers. Is this possible?