# Are gridlines and grey backgrounds chartjunk and should they be used only on an exception basis?

It seems that most authorities agree that dark or otherwise prominent gridlines in plots are "chartjunk" by any reasonable definition and distract the viewer from the message in the main body of the chart. So I won't bother to give references on that point.

Equally, we can all agree that there will be times that pale gridlines to create a reference for viewers will be necessary. Tufte argued the need for (and used) gridlines occasionally, as pointed out in this article. And I agree with the Hadley Wickham's approach in ggplot2 to make such gridlines white on a pale grey background, when you need to use them.

What I am uncertain about however is whether such gridlines and grey background should be the default, as they are in ggplot2. For example, there seems to be no reason for the grey background other than to case the white gridlines into relief - which further begs the question of whether either is needed. I have recently started using ggplot2 for most of my graphics needs and think it is awesome, but it has challenged my "no box, no background, no gridlines" approach to graphics that I used before. I used to think that gridlines=OFF should be my default unless there is a particular reason for adding them in - basically the approach recommended in this article, for example.

Of course, it is straightforward to define a theme in ggplot2 to avoid the gridlines and background shading (and in fact we have done this at my work), but ggplot2's approach is so awesome and generally its default aesthetic choices are good that I wonder if I am missing something.

So - I would be grateful for any references on this point. I am sure it has been well thought through (for example by Hadley Wickham in setting the ggplot2 defaults) and I am very open to being pointed in the right direction. The best I've been able to find is a couple of links on the ggplot2 google group but the most helpful looking reference by Cleveland isn't available at the link given.

• Personally, I like (faint) gridlines for the obvious reason - to make it easier to estimate the values associated with points on the plot. – mark999 Mar 25 '12 at 8:05
• From p. 141 of Hadley's book: "We can still see the gridlines to aid in the judgement of position (Cleveland, 1993b), but they have little visual impact and we can easily "tune" them out. The grey background gives the plot a similar colour (in a typographical sense) to the remainder of the text, ensuring that the graphics fit in with the flow of a text without jumping out with a bright white background. Finally, the grey background creates a continuous field of colour which ensures that the plot is perceived as a single visual entity." – mark999 Mar 25 '12 at 8:15
• Andrew Gelman has done a lot of blogging on infographics, in a similar vein. Personally, I think charts without any reference lines are just as bad as bold, distracting grids. More stylish and cool, but still interfering with understanding and our ability to drill down into information. The idea is not to be minimalist, as if we were all Scandanavian furniture designers, but to clearly communicate, which should include subtle (but useful) reference lines. – Wayne Mar 25 '12 at 13:16
• I notice that there is a lot good discussion here, but all in comments--I wonder to what degree a single, authoritative answer can be provided--I suspect this question would be best as CW, and then we could move (and elaborate) some of these good comments into answers. – gung - Reinstate Monica Mar 25 '12 at 14:26
• I've added an answer drawing on some of the comments and converted it to community wiki – Peter Ellis Mar 25 '12 at 18:38

One thing that may help move the debate forward is to acknowledge what makes people visually distinguish between background and foreground, taking lessons from cartography and apply it more generally to any statistical graphic.

People may initially think that color is a good cue as to whether a specific object is in the foreground or background, but this is not the case. Take for instance this example below, taken from an ESRI blogpost, Make Maps People Want to Look At: Five primary design principles for cartography by Aileen Buckley.

So if I asked you to say which is the figure (e.g. land mass) and which one is the ground (e.g. water body) which one would you pick? A similar phenonenon also happens with the Rubin vase optical illusion.

Some experimental research I remember reading in Alan MacEachren's How Maps Work suggests that in the above pictures people choose the light and dark areas at an equal frequency for the figure (apparently color hue and saturation is used to determine figure from ground). So color can't intrinsically demarcate whether the background competes with the foreground in any statistical graphic, but other cues can help.

People often associate figures as enclosed objects (this is part of the reason the above map is confusing, in that neither mass is enclosed). This suggests in general (regardless of background color), elements in the plot should have clearly delineated boundaries and elements in the plot should be darker than the background. This probably biases the de facto plot background to white, but having a grey background is not damning. Other aspects can be used to delineate between foreground and background (the ESRI blog post mentions a few of these).

One is the hated Excel drop shadow for graphics (example given here in this newsletter by Dan Carr in figure 2). Although that should come with the caveat that people may interpret the numerical attributes at the location of the shadow instead of the intended element.

Another is using different colors/saturation for the outline of an element in the plot versus the interior fill. Examples are given below, with the leftmost circle an example of a not clearly delineated boundary.

These don't appear to be exhaustive either. For line plots it frequently appears that thicker lines come to the foreground, while thinner lines recede to the background.

This is mainly just intended to be food for thought though: your self-study seems to be pretty exhaustive (and I thank you for some of the resources you provided!) I don't think I disagree with any of the resources you provided, but I'm not sure I grok what Hadley is talking about with his motivation for a default grey background. But personal aesthetic preference for grey backgrounds can be accommodated by making sure elements in the plot come to the foreground (that is what really matters). These lessons can be applied to gridlines as well, and if gridlines help and are unobtrusive (i.e. in the background) they certainly are not chartjunk.

• I don't think the main question is distinguishing between background and foreground - I think that's pretty straightforward. The real challenge is creating the graphic in a way that makes it as easy and accurate as possible to make the comparisons that you're interested in. In my experience grid lines make it easier to read off and compare values - although I don't have any formal experimentation to back this up with. – hadley Mar 27 '12 at 15:12
• @hadley, I took it that the (main) complaints about grey backgrounds (and gridlines) were that they were obtrusive, suggesting they compete for attention with the actual data elements in the plot. This to me suggests foreground/background confusion. My assumptions could be wrong though as well (maybe it is purely aesthetic reasons people prefer or dislike them). Distinguishing between foreground and background may be straightforward, but I don't think it is common knowledge, so I hope my post will be useful in that regards. – Andy W Mar 27 '12 at 15:30

Professor Wickham wrote in the ggplot2 book:

"We can still see the gridlines to aid in the judgement of position (Cleveland, 1993b), but they have little visual impact and we can easily "tune" them out. The grey background gives the plot a similar colour (in a typographical sense) to the remainder of the text, ensuring that the graphics fit in with the flow of a text without jumping out with a bright white background. Finally, the grey background creates a continuous field of colour which ensures that the plot is perceived as a single visual entity."

And @Wayne wrote:

" Personally, I think charts without any reference lines are just as bad as bold, distracting grids. More stylish and cool, but still interfering with understanding and our ability to drill down into information. The idea is not to be minimalist, as if we were all Scandanavian furniture designers, but to clearly communicate, which should include subtle (but useful) reference lines"

and @Peter Flom wrote:

I think faint gridlines should be the default in a scatterplot; they help the reader; similarly, blank spaces between words and line in text help the reader. I don't like the grey background, though. I find it distracting. Text, after all, is usually black lettering on white background.

While I tend to avoid the default grey background, perhaps one reason Hadley may have gone with the grey is to allow the user to use more light, saturated colors to display data, which may not appear as effective with a white background.

• Was this intended as an answer to the OP's question, a comment requesting clarification from the OP or one of the answerers, or a new question of your own? Please only use the "Your Answer" field to provide answers to the original question. You will be able to comment anywhere when your reputation is >50. If you have a new question, click the gray ASK QUESTION at the top of the page & ask it there, then we can help you properly. – gung - Reinstate Monica Apr 5 '16 at 16:14
• I actually think this constitutes an answer to the question, at least partially: there is some discussion here as to whether the grey background constitutes chart junk, and some reasoning to suggest why it might not. – Silverfish Apr 5 '16 at 19:11

Personally I prefer the dark-on-light theme_bw, or even theme_minimal, to ggplot2's default theme -- see http://docs.ggplot2.org/current/ggtheme.html.

I find the grey background in the default theme extremely distracting -- my eye is drawn to the grey blocks rather than the points. Does that happen to anyone else? For example, in the toy plot above, my eye is often drawn to the bottom-right (where there are no datapoints).

(Wouldn't it be interesting to see eye-tracking recordings of people looking at these plots?)

Personally I prefer this:

...but it's very subjective -- I don't think there should be a single rule everyone has to follow.

Code for these plots:

library(ggplot2)

n <- 100
df <- data.frame(x=runif(n, max=10), epsilon=rnorm(n))
df$y <- 2 + df$x - 0.05*df$x^2 + df$epsilon

p1 <- (ggplot(df, aes(x=x, y=y)) +
geom_point(size=3) +
ggtitle("Default Theme"))
ggsave("default_theme_example.png", p1, width=10, height=8)

p2 <- (ggplot(df, aes(x=x, y=y)) +
geom_point(size=3) +
theme_bw() +
theme(panel.border=element_blank()) +
ggtitle("Custom Theme"))
ggsave("custom_theme_example.png", p2, width=10, height=8)


According to Kaye Basford & John Tukey in Graphical Analysis of Multi-Response Data, p. 373,

The purpose of plotting is to convey phenomena to the viewer's cortex, not to provide a place to lookup observed numbers.

By that measure, grid lines are best avoided. Further, the gray background of ggplot2 reduces the contrast between the colored points/lines and the background, which makes the pattern in the graphic harder to read.