3MW (A checklist for bar charts)

Guten Tag!

Many greetings from Ulm, Germany.

Bar charts are easy to create but hard to perfect. Anyone can drop some data into a software tool and generate a bar chart. But what then?

Good design is in the details. And most people have seen hundreds of bar charts but are totally oblivious to the details.

So, today we're going through a couple of checks that a bar plot should pass. Here's a standard bar chart I've created with {ggplot2} using the {mpg} dataset. Let's improve it.

Are bars ordered meaningfully?

Here, the bars are sorted alphabetically (by brand name). This can make sense sometimes. But most of the time I think it’s more convenient to sort the bars numerically. This makes it easier for the reader to compare numbers.

In the previous two plots, I have used only a selection of available brands from the data set. That’s because the axis labels would overlap if I use them all. This brings us to our next point.

Are labels on the y-axis?

Whether horizontal bars are always better than vertical bars is debatable. But when you have many bars or long labels, you should definitely opt for horizontal bars.

And please do not rotate the labels on the x-axis. There is a y-axis. Use it.

Is the font large enough?

This is a totally obvious check but it's easy to forget.

Is there unnecessary spacing around labels?

Notice how there is a lot of space between the brands and the actual bars? There is really no reason that there is so much space. Maybe that’s only a problem with {ggplot2}. Maybe other software does that too. In any case, we should remove the extra spacing.

Is there clutter that we can remove?

There’s a lot of clutter due to the excessive use of grid lines. In our case, the horizontal grid lines make little sense. So let’s remove them.

While we’re at it, why not make the whole theme a bit lighter? Some people think of the grey background as clutter too.

Do direct labels make sense?

We can avoid grid lines completely if we label the bars directly.

You could even incorporate the y-axis labels into the bars. Then, you have to make sure that your labels fit into the bars. Maybe this involves abbreviating some of them.

(Optional) Are bars too thick?

This one is a matter of taste. Some people find thinner bars better. So you could try it for your bar chart as well. And when you’re making your bars thinner, you can arrange your labels a little bit differently too. Then, you have to make your plot larger or it will get messy.

That's a wrap! As always, I'm happy to hear your feedback about this week's issue. Feel free to write me on Twitter or reply to this mail.

Enjoy the rest of your day!Albert

Did you like this post and want to support more content like this? You can support me with a coffee or a membership.

Need help visualizing your data? Or need to build a Shiny app? I'm open to freelance work. You can book a free 30-minute Zoom meeting with me and we can find out if I'm a good match for your project.

Reply

or to participate.