Outline

Scatterplots

This doesn’t show all the data!

mpg2008 <- filter(mpg, year == "2008")
mpgplot <- ggplot(mpg2008, aes(cty, hwy)) +
    theme_tufte() + 
    ggtitle("Miles per gallon") +
    geom_text_repel(data = subset(mpg2008, cty >= 26 | cty == 9),
                      mapping = aes(label = model))
mpgplot + geom_point()

Alpha: transparency. Now overlapping points are darker

mpgplot + geom_point(alpha = .5)

“Jittering” the points moves them slightly so they don’t overlap

mpgplot + geom_point() + geom_jitter() +
  geom_smooth(method = "lm", se = FALSE)