Blog

Two Alternatives to Using a Second Y-Axis

Two Alternatives to Using a Second Y-Axis

Almost as often as I see a pie chart with a hundred tiny slivers, I see line graphs using two y-axes. And it is just as bad.

secondaryaxisoriginal

Graphs like this appear in every industry, everywhere I consult all around the globe. Using two y-axes is not a great idea because it gets confusing, fast. Which line goes with which dataset? At least here I have color coded the line to its axis, a smart improvement on what I typically see. Why do people insist on using a second y-axis? I suspect the answer is because they are just easy to make but I often hear reasoning like:

“I want people to see the relationship between these two things.”

Your heart is in the right place, darling, but putting them in the same graph introduces confusion points, like where the academic and behavior lines cross in the graph above. People see that intersection point and think it means something but it really doesn’t. Like “oh I wonder what happened that made behavior suddenly drop below academics.” But these two things aren’t on the same scale, so the point at which they cross is meaningless. By putting these two variables into the same graph, it implies more relationship between the two things being graphed than actually exists in real life.

“I need to fit it all into one graph.”

As in, there’s only room on the slide for one graph, huh buddy? That’s an unfortunate parameter to work within but both of the alternatives here would take up the same amount of space.

 

Alternative 1: Two Side by Side Graphs

Perhaps even easier than making one graph with two y-axes would be to make two separate graphs. Just nestle them up next to each other like best friends. We still see that academics are increasing while behavior is decreasing, without the complicating intersection we had when they were on top of each other. I inserted a textbox that spans across both graphs for the title.  Both graphs are not as wide as a default graph, so I can fit them into the same amount of space as the original graph with two y-axes. This alternative also lets me move the axes titles to a subtitle location, getting rid of the need to read lengthy text vertically.
secondarysplitupdated

Alternative 2: Connected Scatterplot

If you think about it, what’s really happening with two y-axes in the same graph is that we are trying to show a relationship between two continuous variables. That should ring a bell from grad school days. Two continuous variables are usually graphed as a scatterplot. Yet this data also runs over time – which makes a connected scatterplot a sweet, elegant answer. The line connecting the dots in the scatterplot suggests change over time. I added in the years as markers along the line so the chronology is clear.

At first, this graph is not the most intuitive to read. But it’s storytelling powers are pretty impressive. The first segment of the line shows that between 2011 and 2012, academic performance increased (the line moves to the right) but so did the number of behavioral referrals (the line goes up). The second segment continues the story: between 2012 and 2013, academic progress continued (the line goes right) but schools got behavioral referrals under control (the line goes down). This is one detailed story we can see by tracing a simple line. And we can always annotate that story right within the graph using a textbox, like I did here.

 

 

You’ve got two alternatives here, one simple option and one that’s more sophisticated. Either one is going to be a win over the traditional double y-axis graph and both alternatives can still be made right inside Excel. Time to print out this blog post and slip it anonymously into your colleagues’ mailbox!

17 thoughts on “Two Alternatives to Using a Second Y-Axis
  1. Greg Matthews says:

    Hi Stephanie, I like the connected scatterplot and this is timely for me as I have to rework a chart with two y-axes. Do you know of any resources for helping make a chart like that in Excel?
    Thank you,
    Greg

  2. Bob Rudis says:

    Great/informative post (as always).
    For the R folks reading this, here’s one way to do this in R+ggplot2: https://gist.github.com/hrbrmstr/859018befbfb8de25328fffba8b27ef9

  3. Dave Paradi says:

    Stephanie, I see dual axis graphs a lot too. Often they are a combination of a column graph and a line graph where the real reason is to cram more information on the slide:) If the true message is to compare the trend in the two data series, a dual-axis graph can open up the opportunity to manipulate the axis to change the message the audience sees (I wrote an article on this earlier this year at http://www.thinkoutsidetheslide.com/issue-369-august-2-2016/). As I suggest in the article, one way to ensure that the comparison is valid when the data series have two totally different measurement units, is to us an index line graph. For the data above, the graph would look like this. An index line graph is another option people can consider instead of using a dual-axis line graph.

    • Stephanie Evergreen says:

      Yes, yes, constructing a new variable to get them on the same scale. Makes sense. I like that as an alternative. On Twitter, Alberto Cairo suggested the same kind of thing. What I’ve seen in practice is that people will still put something else in there with the index line, creating another dual axis chart! Because the underlying things of “Let’s cram a lot on the slide” hasn’t changed. But I guess that’s why we have workshops, eh? 😉

  4. Tom Shanley says:

    For the first option (side-by-side) I’d prefer to line up the charts one below the other so that the time scales are aligned, which allows the user to see when changes in both variables are potentially related.

    Then using vertical gridlines that align on both charts can help the user compare both charts

  5. Jon Peltier says:

    I strongly dislike dual axis charts. I like two charts, but one above the other, as Tom suggests. In fact, I like to combine them into one chart with two panels. I describe how in Peltier Tech Blog”>Broken Y Axis in an Excel Chart, which is about another axis abomination: the broken axis.

  6. Andrew says:

    Love the post – totally agree with the solutions. A much better way to share the information contained in the data. A minor pet peeve though: the use of curved lines to connect the data points (in the second solution). Certainly a prettier solution, but seems to imply a continuous variable or changes between measured data points. There is nothing objective to support the smoothing of the lines – it is nothing to suggest the change is any more gradual than what we measured: it was A, and now it is B. Love different approach than the second access, but rounding the lines is a triumph of graphic design over literal meaning to me (recognizing it is just my opinion – but I have seen much more egregious examples – try interpreting without the line markers)

    • Stephanie Evergreen says:

      Good point, Andrew! The markers help designate actual data points, so one doesn’t put too much meaning into other places along the curved line. But I completely hear you. Thanks for bringing it up. Stick straight lines are an option, of course.

  7. Nan shellabarger says:

    I prefer stacking the two graphs vertically so the years are aligned. But it drives me nuts to do do this in excel because you have to line them up manually, there is no way to stack different variables using the same x axis.

    • Stephanie Evergreen says:

      Can’t you just click on both graphs, and click on Align > Right (or Left or Center)? Should work perfectly if they are the same size.

  8. Mark Proctor says:

    Great post. In terms of using a two axis line chart, I think the relative movement of each line also creates an expectation of the relationship between the two lines. If both lines appear to move by roughly the same amount it implies that one has an equivalent impact on the other. However the maximum of the second axis could stop at any number. The axis could end at 20, or 4.5, both of which would create a different relationship between the two lines and tell two different stories. The two charts side by side (or one above the other) works best for me.

  9. Vaibhav says:

    It maybe true for most of the metric you wanted to plot, but what about cases where there are genuine co-relation between the 2 metrics and trend of one metric shows the variation in other.

Leave a Reply

Your email address will not be published. Required fields are marked *

RT @LizTweets: Use the free StateFace font from @ProPublica to incorporate tiny US state icons into your text. How cool is that?! https://t…

RT @EvanSinar: Using The Gauge Diagram for Qualitative Data Visualization @evergreendata https://t.co/wKudJkk1f2 #dataviz https://t.co/x…

@cisey you're welcome! So fun!

5 hours of detention by immigration cannot keep the #dataviz from #Canada. https://t.co/5CfgMjQelb

RT @net2van: #Qualitative Data Visualization: The Gauge Diagram https://t.co/CBKwuaFqAk When numbers aren't a fit for your #dataviz @evergr

Audible groans when this slide came up at #evalYOW17 https://t.co/t6IOW826cy

RT @katiedrumm: Excuse me, GMG is hiring a graphics and data viz editor. Please RT and tell your talented friends: https://t.co/cobHh1y5UW

So much fun keynoting & workshopping #dataviz at #evalYOW17 https://t.co/nDkqzXnW9d