Calculus Title Image

10 steps to making your graphs not suck

In Tutorial by Morgan ByeLeave a Comment

Recently I wrote about how your graphs suck. It even generated a little bit of a stir over on LinkedIn. I am not however, the kind of person that points at a problem and walks away. I taught lab classes full of trainee chemists, biochemists and pharmacists for over 4 years. Over the years, I’ve read and marked more experiment reports than I want to think about and let me tell you, I have seen some truly shocking graphs. Including one quick hand sketch in a printed report with an apology post-it attached, “Trust me, it looked a bit like this.

With this in mind, let me give you 10 kick-ass steps to making one, awesome, graph to rule them all.

1) Decide what you are trying to show

First thing, first. Why are you making a graph? What are you hoping to achieve with it? Decide what you are presenting.

In the original post, I was trying to present that the number of children dying around the world, in the first year of life, is dramatically dropping.

That was the “what“.

The data itself is really convincing. Conceptually, the graph is really easy to understand. Label anything with “Children deaths” and people are going to be able to piece together that seeing a line going down is a good thing.

The “why” in this graph, was also easy. Convince the reader that the world is a better place than it was.

I know that I can use my words and talk about this. Or I can present this data, knowing that a single graph will be more powerful than any words. The data itself, is convincing. Any graph with “Children deaths” and a line going down has got to be a good thing, right?

The simple truth is that I lead someone down a line of thinking, I can highlight several connected points, but I always let them contact the dots themselves. That way, the idea is theirs. Who are you going to believe? We intrinsically trust our own judgement and reasoning more than anyone else’s.

Pirates Vs Global Warming

2) Choose the right graphs

Some data you might look at and think “I know exactly what to do with that!” Some graph types are obvious choices for certain applications. But remember, we are trying to make a persuasive argument with our graph. It does not matter if we are a writer, a market analyst or even a scientist. There is always a reason that graph exists.

With my example, I have 50 years of data. Every year, the World Health Organisation collects all the data from around the world and reports a number for how many children died. What I want to show is a downward trend. Down means less dead babies. Down is a good thing.

Each year has a number associated with it. In theory, this data could be graphed with a bar chart.

Bar graph

There’s nothing wrong with this in theory. In the real world though we think of time being a continuous thing, not something that comes in boxes. When time is involved, it makes more sense to our brain to have a line graph, it implies that something is always happening. Whereas our brains’ look at a bar chart and infer that everything happens on one day in the middle of June and then nothing happens for the rest of the year.

3) Where’s the emphasis?

Certain style choices can add to or distract from the point you are trying to make.

How many data points are there? Do you want to show every single one of them?

Do you want to use a straight line between points or is a smooth curve better?

  • Data point graph
  • Straight line graph

What about filling the area under the curve? Rarely seen in the natural sciences, but if I am trying to show a number get really small, the fill really helps the eye see something get smaller.

  • Unfilled graph
  • Filled graph

These things make a real difference.

4) Get those axes sorted

The axes are those things that run along the sides of the graph. You must make sure that all of the data is actually displayed – there’s nothing worse than having a graph zoomed in so it looks like the data runs off the page. Most of the time, the axes are linear – i.e. every gap is the same size, but sometimes you will need to consider other options. Think about trying to show something that doubles every year.

Most graphing software automatically looks at your highest and smallest points, gives a bit of space either side for good measure, then just sort of split it however it likes. Usually something like biggest at the top, smallest at the bottom, and 3 marks in the middle.

Our graph goes to just under 125, but the software has decided that using the perfectly normal interval of 32.5 births is the right thing to do. Just ask any mother what half a birth looks like! The x-axis is stepping in sets of 4 years, which is a) a weird interval and b) leaves the axis a bit crowded.

  • Unfilled graph
  • Axes graph

We want a graph that looks clean and professional. Humans have ten fingers, and the current global counting standard uses base 10 (we have 10 numbers 0 to 9, before we go back to a 0 and add another digit to make 10). Our brains like multiples of 10. 5’s are good too. Even numbers are better than odds. Think about changing the volume on the TV, if there is a numbered scale, most people will pick multiples of 2 or 5 – even when it’s a bit loud.

Obviously your axes are going to change depending on the circumstance – use your sense.

Speaking of sense, please don’t use a crazy number of numbers on your axes! Don’t use $1000000, $2000000, $3000000! Use 1, 2, 3 and then state that the axis is in millions of dollars.

If you are using a continuous scale (like time), or the labels are quite large then I would personally recommend using tick marks (those little lines that come off the axis). They really help work out where the label is pointing..

5) Grid lines are your friend

Grid lines take your graph from looking like some tacky infographic into respectable science. In your brain, it says that the data is actually good data worth looking at. It says that each data point is good enough to actually measure. No one is going to get a ruler out and read off the numbers, but the fact that you could makes the data feel better.

The trick to good grid lines are to use them sparingly. Only use them on the major ticks. Here I have used a vertical line every 10 years, you could go as low as 5 years but it would help the graph. Adding a line for every year makes the graph starts to feel like an optical illusion where your eyes go funny. 

  • Axes graph
  • Grid line graph

The idea of the grid line is to add to the graph, not distract from the data. Notice that my grid lines are light. They are both a light weight (1 pt) and a light colour (grey40). They add to the graph, without distraction. Heavy grid lines distract the eyes and dilutes the message of the graph we are trying to share.

If you have to, really have to, show a lot of grid lines – maybe like a calibration curve, where people will need to read data off the graph. Then please, please, please put the major line in a different colour and a heavier line thickness (3 pt) to the minor lines. A good example would be to have light blue grid lines, with every 5th or 10th line being double the thickness and red.

6) The best things in life come in a box

All the best graphs come in a box. Quick sketches might come with open sides, predictions into the future might leave space for the idea of expansion. Data that has a finite beginning and end has limits and therefore, should be a box.

The reason is that, whenever a graph appears, website or printed page, that graph is going to be surrounded by either text or other graphs. Boxing the figure both highlights and separates it from everything around it.

  • Grid line graph
  • Boxed graph

See what I mean!

7) Axis titles make things relevant 

Axis titles turn a few pretty lines into a graph with meaning.

An ideal axis title should be short enough to give it punch, but large enough so the reader doesn’t need to read everything around the graph.

I keep my axis title in the same font as the rest of the graph, but I increase the font size by a few points, so that there is a visual hierarchy showing that it is a title and more important than the numbers on the axis.

  • Boxed graph
  • Axes title graph

It is extremely important to include units. Time, money or anything else must be in the axis title. If this graph was going in a formal report I would state the x-axis as “Time / Year”, as this graph is less formal “Year” is sufficient for the user to understand.

Some people prefer to put units in standard curved brackets, like “Money ($)”, but I would always go with a forward slash then the unit or format, like “Distance / km” or “Time of day / hh:mm”. Obviously, this stylistic touch is down to you, your field or the style guidelines of wherever you are writing for. I use the slash mainly because I am a member of the Royal Society of Chemistry and my degree is recognised by them, so I use their style guide for most of my writing.

8) Give a little context (Add a title)

A graph should be able to stand alone. They rarely do, but they should be able to. On a website, many visitors skim the text in favour of pictures. Skimmers need to be able to understand the graph without having to read the text – a good graph will make them go back and read the text. In print media, page layouts mean that graphs are rarely placed exactly next to the right bit of text.

Adding a title is the easiest way to add context to a graph.

Titled graph

Again, make the text larger than anything else, so that the visual hierarchy is maintained and no one is in any doubt that it is a title. Make the title short and punchy.

If you are writing a full report, then a title may not be necessary but context should be given in different ways. Reports should have figure legends or captions above or below the graph, so that the graph can be properly explained without having to go read a whole page of text.

9) Add some style

Now that we have a graph that we’d be proud to hang on our bedroom wall, it is time to add some personal touches and considerations.

I once sat in a brightly lit, 600 seat, lecture theatre for a scientific conference. The presenting professor revealed a graph drawn with tiny lines, drawn in light yellow on a white background… “As you can clearly see… Oh… Well… Maybe you can’t…“. If the professor, less than 3 metres from the screen could not see anything, imagine what the rest of us in the audience could see.

Always remember where this graph is going to end up. You are trying to convince people of a point. Part of being convinced is being able to see things for yourself. That professor convinced exactly no-one of his point. If you are making a graph for a lecture theatre, make it big, make the text big, make all of the lines big, make all of colours big and bold. Here, the graphs are adding to the text – I could make them twice the size, but it would only make you spend more time scrolling down the page.

Finally, when you are happy with everything else then you can add a bit of styling.

  • Titled graph
  • Styled graph

Maybe change the fonts to fit the rest of your work. Maybe fix the size so that it is the same size as all your other graphs.

I accent all of my work in orange, so to maintain consistency, I change the key graph elements to the same orange colour.

 

10) Proof, proof and proof again

Finally, once you have got a complete graph – check that it actually is. Check for spelling mistakes and typos. Check that all the data is present. Check that none of the text has mysteriously disappeared, changed colour, size, font or is now hidden. Once you think you are happy, zoom right in, then zoom out, make sure everything with your graph looks right. Then make sure that the graph is fit for purpose.

Now you are ready to export your graph. Always export your graph as an image file, do not just copy and paste it across. Different programs have amazingly different compatibilities with each other, and you will often lose a lot of quality by copy/pasting. It also gives you a backup for when that PowerPoint file gets lost or corrupted.

  • Initial graph
  • Final graph

Wherever possible export your graph as a vector image (i.e. *.eps, *.svg or even *.pdf) rather than a bitmap (i.e. *.bmp, *.jpg, *.png). Vector images can be expanded as big as you like without losing any quality. Ideal for printing in a thesis or on a poster! If publishing to the web, then your best bet is *.png as it is compatible everywhere (and the file size is good), but modern browsers (and HTML5) are increasingly supporting *.svg.

Once you have exported the file, make sure you actually open the image file and look at it. A lot of things can go wrong when exporting graphs to image files. Common problems include text going funny (font problems), text gets hidden (usually layering issues) or colours are not quite right (image format problems). Bitmaps are also prone to random resizing.

Summing up

No single part of graph making is hard. No single step is difficult to understand. Unfortunately, I have seen so many bad graphs. Some even in established financial publications.

Now that you have your own kickass graphs, it is time to release them upon the world. Take a moment to appreciate the difference in quality between the graph you just made and the one that would have done-the-job. Feel the perfectionist inside of you smile. Remember that article you read that spelt out why each little part of the sum was important.

Knowledge is a curse, and now you’ll start to see bad graphs everywhere too. Maybe you already have somebody in mind. Next time you see a bad graph, maybe subtly share this article with them. Together we can make the world’s graphs better!

About the Author

Morgan Bye

Facebook Twitter Google+

Morgan Bye is a British science writer, out of Vancouver, Canada, dedicated to helping scientists better communicate their science. He has a Masters in Biochemistry, a PhD in Biophysical Chemistry and even spent time as a scientist at an Israeli research institute.

Title image is adapted from Akash Kataruka via Flickr under CC.