Site icon R-bloggers

Making R graphics legible in presentation slides

[This article was first published on Civil Statistician » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I only visited a few JSM sessions today, as I’ve been focused on preparing for my own talk tomorrow morning. However, I went to several talks in a row which all had a common problem that made me cringe: graphics where the s (titles, axes, labels) are too small to read.

You used R's default settings when putting this graph in your slides? Too bad I won't be able to read it from anywhere but the front of the room.

Dear colleagues: if we’re going to the effort of analyzing our data carefully, and creating a lovely graph in R or otherwise to convey our results in a slideshow, let’s PLEASE save our graphs in a way that the text is legible on the slides! If the audience has to strain to read your graphics, it’s no easier to digest than a slide with dense equations or massive tables of numbers.

For those of us working in R, here are some very quick suggestions that would help me focus on the content of your graphics, not on how hard I’m squinting to read them.

If any of that’s unclear, here’s a quick example, using the trusty old iris data:

Bigger text, labels instead of legends, and colorblind-safe color choices: much easier to read in a big presentation room.

# Set up a colorblind-safe palette with three colors
library(RColorBrewer)
iriscolors = brewer.pal(3, "Dark2")

# Find the means of each cluster
irismeans = aggregate(iris[3:4], by=iris[5], FUN=mean)

# Create the plot with a larger point size
png("LegibleGood.png", pointsize=18)
# Use pch=20 so dots are filled, not hollow
plot(iris[3:4], col=iriscolors[unclass(iris$Species)],
  main="Iris Data", pch=20)
# Label the clusters near their means
# (adjusted manually so labels do not overlap points)
text(irismeans[,2]+c(1,1,-1), irismeans[,3]+c(0,-.2,.2),
  irismeans[,1])
dev.off()

Let me know if there’s anything unclear in the example above, or if you have a better way to do this or any other advice to offer.

For more suggestions on preparing good presentations, see also:

To leave a comment for the author, please follow the link and comment on their blog: Civil Statistician » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.