1. Learn
  2. /
  3. Courses
  4. /
  5. Data Science Visualization - Module 2

Exercise

Exercise 19. Smooth density plot

Now instead of a histogram we are going to make a smooth density plot. In this case, we will not make an object p. Instead we will render the plot using a single line of code. In the previous exercise, we could have created a histogram using one line of code like this:

heights %>% 
  ggplot(aes(height)) +
  geom_histogram()

Now instead of geom_histogram we will use geom_density to create a smooth density plot.

Instructions

100 XP

Add the appropriate layer to create a smooth density plot of heights.