Rowan Trebilco
April 24th 2015
“While graphics technology is moving along at a rapid pace, the human visual system has remained the same.”
– Cleveland (1994) The elements of graphing data
examples of new advanced visualisations:
Tufte's rules and general principles
hints for customising plots in R base graphics
“The Visual Display of Quantitative Informaiton” by Edward Tufte (1st edition 1983)
“The Elements of Graphing Data” by William S. Cleveland (1st edition 1985)
“R Graphics 2nd edn.” by Paul Murrell (2011)
Books by Stephen Few and www.perceptualedge.com
Spoon said not to forget to mention: Displaying Time Series, Spatial, and Space-Time Data with R (Lamiguero, 2014)
some great examples of data graphics: http://bost.ocks.org/mike/
Graphical excellence
Gives the viewer the greatest number of ideas
in the shortest time
with the least ink
in the smallest space
“Above all else, show the data”
– The Visual Display of Quantitative Information
Bad
Better
Even better
This
vs. this
Show data variation, not design variation
Su 2008 Computational Statistics and Data Analysis 52, 4594-4601
Show data variation, not design variation
Su 2008 Computational Statistics and Data Analysis 52, 4594-4601
Chartjunk includes most:
… but see Bateman et al. 2010 “Useful Junk? The Effects of Visual Embellishment on Comprehension and Memorability of Charts”
=> chartjunk can be useful for info-graphics?
Maps are are a point of reference for both maximising data-ink and minimising chart-junk
We're good at percieving:
We're bad at percieving:
choose a sensible colour scheme
library(RColorBrewer)
display.brewer.all()
display.brewer.pal(5, "YlOrRd")
choose a sensible colour scheme
library(gplots)
m <- abs(matrix(1:120+rnorm(120), nrow=15, ncol=8))
barplot(m, col=rich.colors(15), main="\nrich.colors")
Carefully consider aspect ratio
Line things up to facilitate comparisons
don't be surprised if you spend lots of time customising and revising
try to make your processes as repeatable as possible
General hints
“build” graphs by using type = “n” and axes = F, then sequentially adding elements
call a device driver from a script rather than saving from a window
par settings
a good habit to get into:
dev("filename.pdf")
op<- par([my-settings])
... my plot
par(op)
dev.off()
useful par settings and what they control
useful par settings and what they control
family: font family (for journals that care)
par(“usr”): returns the location of the limits of the plotting area
will return the RHS limit of the x axis
par(“mfrow”) (and mfcol)
layout()
par(mfrow=c(2,2))
for(i in 1:4) plot(i, pch=i)
use par to shrink inner margins, for common axes
par(mfrow=c(2,2), mar = c(0,0,0,0), oma=c(2,2,2,2))
m<- matrix(c(1,1,1,1,2,2,3,4),nrow=2,ncol=4)
layout(m)
layout.show(6)
You can draw lines between panels using
grcoverntX() and grconvertY()
Let me know if you want the code!