By Jeff Harrison
Graphs are pictures that help humans make comparisons and spot patterns in data. Using size, color, position, and other visual cues, a good graph is designed to support this analysis. Designing a good graph means going beyond simply dropping your data into a pair of axes. Making sure that the right comparisons are easy can make all the difference for your audience.
Here’s an example. My car claims to tell me how many miles I can drive before refueling:
I have 260 miles left on this tank. That’s enough to reach Des Moines—and freedom!
The number isn’t exact. To start with, it’s always a multiple of ten miles. This would still be precise enough to be useful to me if it were reliable, but the number also jumps around a bit. Sometimes it goes down by twenty miles when I’ve only driven five, and occasionally it actually goes up.
This variation makes sense when you think about it. Cars have different fuel efficiency ratings for city driving and highway travel. For most cars (mine included) the city number is smaller because every time you stop at an intersection you lose your momentum and have to burn extra gas to get up to speed again. (The city number is higher in hybrids, which use the battery for driving at lower speeds.) The projection’s uneven progress toward zero could mean that it’s based in part on my recent fuel usage. And, indeed, the manual confirms that the projection is based on fuel consumption over the last 19 miles.
That’s good to know, but it doesn’t tell me how far off the prediction is likely to be at any given moment. To put some numbers on it, I decided to collect some data. I reset my trip odometer to zero when I filled the gas tank. Then, every time I arrived at a destination, I recorded how many miles I had traveled, and what my projected remaining miles were. Then I dropped this data into a line graph:
The initial estimate when I filled the tank that time was 430 miles. Practical considerations prevented me from driving until I ran out of gas, but it looks like I would have landed somewhere near there, or possibly a little higher. The gas light came on at 373 miles, when the projection read 60; it’s slightly off the trend because it came on between stops and I took note of the numbers at that point.
Make It Easier
As expected, the projection trend is not a straight line, but it’s kind of hard to estimate the variability with confidence. In order to do so you have to compare it against an imaginary diagonal line that represents what an ideal projection would look like.
Realizing this, I looked for a way to make it easier. Humans are better at making comparisons against a horizontal baseline than an angled one. Adding the miles already driven to the Y axis lets us plot projected total miles, which gives us that comparison:
This graph makes it easier to judge the vertical distance from valleys to nearby peaks. The trend’s range—the vertical variation—over the left half of the graph is 60-70 miles. We don’t know what the correct final number would have been, but the spread alone is enough to convince me not to pay too much attention to this number when my tank is even half full.
There is variation on the right side of the trend, too. These more gradual changes are much easier to detect in this version than in the first one. They suggest that the projection is still varying with my fuel consumption, but that the variation is less when the tank is emptier. This would make sense because having three gallons of gas gives you a smaller range of possible outcomes than does a full tank. However, a more gradual slope could also indicate a different driving pattern. Perhaps this last section contained trips that were more efficient than my typical errand-running but less efficient than my commute.
To shed some light on that, I looked back at my trip log and added an overlay to my trend to call out segments that were predominantly highway driving:
This graph illustrates that highway driving reliably made the projection rise. In the first half of the experiment, highway trips pushed the projection to about 480 miles. Segments comprising many short errands and school drop-offs brought the projection back down. The graph also shows that I actually drove more highway miles during the second half of the tank, but that these periods of (presumed) higher fuel efficiency failed to bring the projection up to its earlier highs. The variation during the last rise is only about 30 miles. It’s difficult to measure this variation in the original graph, but in this one it’s easy.
In the end I decided to disable the projection, though I sometimes turn it back on when the gas light comes on and it’s not convenient for me to stop at a gas station right away. Another thing I learned from the manual is that the light is designed to come on when there are 2.6 gallons remaining in the tank, which tells me I do have some breathing room there. This may some day get me into trouble but for now I’m seeing it as a win, at least until I’m stranded in the woods with promises to keep.