Exercise

Exercise 21. Two smooth density plots 2

In the previous exercise we made the two density plots, one for each sex, using:

heights %>% 
  ggplot(aes(height, group = sex)) + 
  geom_density()

We can also assign groups through the color or fill argument. For example, if you type color = sex ggplot knows you want a different color for each sex. So two densities must be drawn. You can therefore skip the group = sex mapping. Using color has the added benefit that it uses color to distinguish the groups.

Instructions

100 XP

Change the density plots from the previous exercise to add color.