1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Data Visualization with ggplot2

Exercise

Modifying stat_smooth (2)

In this exercise we'll take a look at the standard error ribbons, which show the 95% confidence interval of smoothing models. ggplot2 and the Vocab data frame are already loaded for you.

Vocab has been given an extra column, year_group, splitting the dates into before and after 1995.

Instructions 1/2

undefined XP
  • 1
    • Using Vocab, plot vocabulary vs. education, colored by year_group.
    • Use geom_jitter() to add jittered points with transparency 0.25.
    • Add a smooth linear regression stat (with the standard error ribbon).
  • 2

    It's easier to read the plot if the standard error ribbons match the lines, and the lines have more emphasis.

    • Update the smooth stat.
      • Map the fill color to year_group.
      • Set the line size to 2.