Data Visualization

Making Publication Quality Figures

Overview

Teaching: 5 min
Exercises: 5 min
Questions
  • What makes up a publication quality figure?

  • What customization features are in ggplot2?

Objectives
  • To generate a publication quality figure using ggplot2

ggplot2 customization for publication quality figures

Line Histogram Fill-in Challenge Continued

Fill in the missing pieces of the following code to generate a publication quality line histogram.

ggplot(________) +
  ________ +
  labs(________, y = "Count") +
  theme_classic(base_size = 24, base_family = ________) +
  theme(axis.title = element_text(size = 36))

Output Solution

line histogram

Code Solution

ggplot(Africa, aes(log10(pop_2007), ..count..)) +
  geom_density() +
  labs(x = "Log10( 2007 Population )", y = "Count") +
  theme_classic(base_size = 24, base_family = "Helvetica") +
  theme(axis.title = element_text(size = 36))

Key Points