Themes

Harold Nelson

2022-09-26

Setup

library(ggthemes)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6      ✔ purrr   0.3.4 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.4.1 
## ✔ readr   2.1.2      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()

A Basic Plot

p <- ggplot(mtcars, aes(x = wt, y = mpg, colour = factor(gear))) +
  geom_point() +
  facet_wrap(~am) +
  geom_smooth(method = "lm", se = FALSE)

p
## `geom_smooth()` using formula 'y ~ x'

Add the fivethirtyeight theme

p + 
  theme_fivethirtyeight() +
  scale_color_colorblind()
## `geom_smooth()` using formula 'y ~ x'

p + theme_economist()
## `geom_smooth()` using formula 'y ~ x'