Favorite theme

For presentations, theme_bw() or theme_minimal() look useful:

ggplot(data = mpg) +
  theme_bw() +
  geom_jitter(mapping = aes(x = displ, y = hwy, color = class)) +
  scale_x_continuous(name = "Displacement") +
  scale_y_continuous(name = "Fuel economy [miles per gallon]") +
  scale_color_brewer(name = "Car class", palette = "Set2")

ggplot(data = mpg) +
  theme_minimal() +
  geom_jitter(mapping = aes(x = displ, y = hwy, color = class)) +
  scale_x_continuous(name = "Displacement") +
  scale_y_continuous(name = "Fuel economy [miles per gallon]") +
  scale_color_brewer(name = "Car class", palette = "Set2")

Legend at bottom

ggplot(data = mpg) +
  theme_bw() +
  geom_jitter(mapping = aes(x = displ, y = hwy, color = class)) +
  scale_x_continuous(name = "Displacement") +
  scale_y_continuous(name = "Fuel economy [miles per gallon]") +
  scale_color_brewer(name = "Car class", palette = "Set2") +
  theme(legend.position = "bottom")

theme_bw() overwrites everything, including the legend position:

ggplot(data = mpg) +
  geom_jitter(mapping = aes(x = displ, y = hwy, color = class)) +
  scale_x_continuous(name = "Displacement") +
  scale_y_continuous(name = "Fuel economy [miles per gallon]") +
  scale_color_brewer(name = "Car class", palette = "Set2") +
  theme(legend.position = "bottom") +
  theme_bw()

Copyright © 2018 Kirill Müller. Licensed under CC BY-NC 4.0.