Guide to presenting graphs

Monica Thieu

Spelman College WiSTEM

7/19/23

The purpose of a graph

is to communicate a comparison.

Graphs are for… 1

  1. Comparison
  2. Impact

We can design graphs both to highlight a data comparison, and to communicate that comparison clearly and attractively.

How to build a presentation graph

Start with the base plot

base_plot <- data_to_plot |> 
  ggplot(aes(x = n, y = fct_reorder(country, n))) +
  geom_col()

Clarify the comparison of interest

base_plot <- data_to_plot |> 
  ggplot(aes(x = n,
             y = fct_reorder(country, n),
             fill = country_is_usa)) +
  geom_col()

Clarify the comparison of interest

annotation_x <- data_to_plot$n[data_to_plot$country == "United States"]

base_plot +
  annotate(geom = "segment",
           x = annotation_x, y = 7,
           xend = annotation_x, yend = 9,
           linewidth = 2, arrow = arrow())

Clarify the comparison of interest

You can also use annotate() to place a ggplot annotation layer on top of your data layers. You will need to position the xy coordinates manually, by specifying constants.

Make the legend more readable

next_plot <- base_plot +
  guides(fill = guide_legend(title = NULL))

Or, remove the legend if it’s self-explanatory

next_plot <- next_plot +
  guides(fill = "none")

Make the axis ticks more readable

next_plot <- next_plot +
  scale_x_continuous(labels = scales::label_comma())

Label the axes

next_plot <- next_plot +
  labs(x = "Number of respondents",
       y = "Country of residence")

Add an informative title

next_plot <- next_plot +
  labs(title = "Most respondents are from the USA")

Make text larger

next_plot <- next_plot +
  theme_grey(base_size = 16)

Adjust theme

next_plot <- next_plot +
  theme_bw(base_size = 16) +
  theme(plot.background = element_rect(fill = "transparent",
                                       color = "transparent"))

Adjust data colors

next_plot <- next_plot +
  scale_fill_manual(values = c("United States" = "#e34a6f",
                               "All other countries" = "grey50"))

Adjust plot colors

next_plot +
  theme(panel.grid = element_line(color = "lightsteelblue1"),
        panel.border = element_rect(color = "steelblue4"))

Adjust plot colors

Please do not get too crazy with plot colors! 😅 Prioritize readability for grid lines, axis tick labels, etc.

If you are presenting slides on a projector, you may adjust plot colors to make them darker to combat wash-out.

Adjust fonts

First, you have to use the sysfonts package to manually add the Google fonts you want to use on your graphs.

library(sysfonts)
font_add_google(name = "Nanum Gothic")

sysfonts is not a default package, so you will need to install it if it hasn’t already been installed in your project.

Adjust fonts

next_plot <- next_plot +
  theme(text = element_text(family = "Nanum Gothic"))

How to present a graph

How to present a graph

  1. Walk through the elements of the graph
  2. Walk through the key comparison
  3. State the takeaway

Walk through the graph axes

“The x-axis represents the number of survey respondents from each country.”

Walk through the graph axes

“The y-axis shows the top 10 most-represented countries of residence for survey respondents.”

Walk through the data layers

“The length of each bar shows the number of respondents from that country.”

Walk through the key comparison

“You can see that over 500,000 respondents come from the USA. That’s more than half of all the respondents in the dataset.”

State the takeaway

“This graph shows us that any patterns we see in this dataset may be driven by the American respondents.”