To grid or not to grid

Defaults are difficult.

I had a twitter discussion with ggplot2 author Hadley Wickham on whether or not to include a grid background in plots. He thinks the default should have a grid, I think the opposite. I believe we both agree that grids make sense for some plots and not for others, so this is just a question about defaults. On that issue, we remain in disagreement.

One of my preferred methods of data visualization is to take two variables that measure the same quantity in different ways or different systems and then plot one versus the other. As an example, see this figure from a paper my lab published last year. In this kind of a plot, a grid would be highly distracting. In general, I like to add guiding lines that highlight specific features of the data. For example, if the most important feature in the data is whether y values fall above or below one, then placing a horizontal line at y = 1 would be a good idea, and it would likely be more helpful than a generic grid covering the entire plot. However, I do agree that if one does a lot of faceting, a grid may be necessary. In fact, yesterday I played around with faceted plots without background grid, and I noticed that they had a tendency to fall apart and not look very convincing. Without grid, the eye has little to go by in these plots.

So, if I can see the value of a background grid in some cases, why am I not convinced that it is the right default? When it comes to constructing plots, I fundamentally believe in an additive rather than a subtractive model. That is, start with a plot that is as empty as possible, and then add everything you need until you have a clear and informative graph. In a subtractive model, you would start with all sorts of additional visual elements of which you remove those you don’t need. While both approaches can lead to the same end result, it is my experience from ~15 years of supervising students, and from reviewing oodles of papers with poor-quality figures, that most people don’t remove visual noise from a graph unless explicitly prompted to do so. If ggplot2 places a gray background grid, then a gray background grid it is. Therefore, in my own personal plotting package, whose intended purpose is internal use in my lab, the default is no background grid. I’d rather say on occasion “please add a background grid to this figure” than having to repeat over and over “please remove the background grid.”

Claus O. Wilke
Professor of Integrative Biology


comments powered by Disqus