Home > R > Adapting graphs for presentations

Adapting graphs for presentations

I’ve just finished reading slide:ology by Nancy Duarte. It contains lots of advice about how to convey meaning through aesthetics. The book has a general/business presentation focus, but it got me wondering about how to apply the ideas in a scientific context. ┬áSince graphs from a big part of most scientific talks, and since that’s the bit I know best; that’s what I’m going to discuss here.

We start with a basic example using the ggplot2 mtcars dataset.

p_basic <- ggplot(mtcars, aes(wt, mpg)) + geom_point()

A scatterplot, designed for the screen or page

Something I’ve been burned with recently is overestimating the size of the projector screen. Although my graphs looked great when my face was next to my monitor, the axes were hard to read when projected. A good rule of thumb for text is your font size should be half the age of the eldest member of your audience or 30 points, whichever is bigger. For graphs axes we can perhaps get away with something a little smaller. Don’t forget that by the time you’ve printed your graph to file and played with it in your presentation software, the font size you’ve picked may bear no relation to it’s final value. That said, the point remains that you need to make the text bigger.

old_theme <- theme_set(theme_grey(base_size = 24))

Increased text size

Reading a graph can be quite an in depth process which can overwhelm you audience. Once you’ve shown them the graph in its basic form, you should emphasis interesting features, one at a time. The one at a time thing is important – if you want your audience to be concentrating, then you shouldn’t distract them with many things at once. Here I’ve increased the size of the outliers in the bottom right hand corner.

mtcars <- within(mtcars, emph <- wt > 5)

p_emph <- ggplot(mtcars) +
  geom_point(aes(wt, mpg, size = emph)) +
  opts(legend.position = "none") +
  scale_size_manual(values = c(2, 5))

The outliers on the right are emphsised

As well as emphasising values, a useful tool can be to de-emphasise other regions of the graph. Overlaying a translucent white rectangle on such regions does the trick nicely.

x_lower <- floor(min(mtcars$wt))
x_upper <- ceiling(max(mtcars$wt))
y_lower <- floor(min(mtcars$mpg))  -1
y_upper <- ceiling(max(mtcars$mpg)) +1

p_deemph <- p_emph +
  geom_rect(
    aes(xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax),
    data = data.frame(
      xmin = c(x_lower, 5),
      xmax = c(5, x_upper),
      ymin = c(y_lower, 16),
      ymax = rep.int(y_upper, 2)
    ),
    fill = "white", alpha = 0.6
  ) +
  scale_x_continuous(limits = c(x_lower, x_upper), expand = c(0, 0)) +
  scale_y_continuous(limits = c(y_lower, y_upper), expand = c(0, 0))

The rest of the plot is de-emphasised by a translucent white covering

For more deemphsising more complicated regions, I find it easier to use dedicated image manipulation software. Paint.NET is my personal zero-cost favourite but any graphics software should suffice.

Finally, it can be useful to annotate your graph.

p_annotated <- p_deemph +
  geom_text(
    aes(x = x, y = y, label = label),
    data = data.frame(x = 5, y = 13, label = "outliers!"),
    size = 14
  )

Text annotation can assist the focus too

By now, if your audience hasn’t figured out which bit of the graph you want them to look at you’re in trouble. Let me know in the comments if you have any other ideas for how to draw graphs for presentations.

About these ads
Tags: ,
  1. Michael Bibo
    29th October, 2010 at 10:58 am

    Some good points, but I can’t help wondering if it might be easier to use better presentation software to do your highlighting and magnification of different parts of the graph. Impressive (http://impressive.sourceforge.net/) will display slides from a pdf or a directory of jpegs, and allows for highlighting a portion of the screen in a very similar way on the fly, as well as magnifying a portion of the screen. It is python-based, so cross-platform. It can even be run in windows from a usb stick if you are a guest on someone else’s machine.

    • 29th October, 2010 at 11:53 am

      Thanks for the link – Impressive does look, well, impressive. I agree that dynamic highlighting sounds very useful; it would clearly give you more flexibility than preconceived static highlighting. As long as interaction with your slide is easy enough that you don’t get distracted from your audience, it sounds great.

  2. 2nd November, 2010 at 6:39 am

    I just scanned slide:ology based on your link, and … it looks terrible! Not Tufte-y or Few-y at all!

    Thanks for sharing the code, too.

    • 2nd November, 2010 at 17:31 pm

      It’s interesting because both Tufte and Few are mentioned in the book and have clearly had some influence, but the focus is very different (Duarte is a graphic designer).

      As a consequence, she’s a little over fond of cheesy corporate looking photography but there is a lot of good practical advice contained within. I particularly liked the stuff about implicit messages contained in the layout of your slides. (If you have several objects onscreen, then their relative locations and sizes contain meaning about the relations of the objects, etc.).

  1. 30th October, 2010 at 23:44 pm
  2. 31st October, 2010 at 22:20 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 229 other followers

%d bloggers like this: