Clustered bar charts

This module should take 30 minutes to complete.

When to use clustered bar charts

Clustered bar charts are useful when you want to compare groups within clusters and across clusters.

Figure 1: Levels of fruit stock in four shops, fictional town, 2022

The legend is the same order and orientation as the bars in each cluster

Larger version of figure 1.

This clustered bar chart shows fictional data on levels of stock of different fruit across four shops.

The bars allow you to compare stocks of a certain fruit across the four shops. The clusters allow you to compare how overall stock levels compare across the four shops.They also allow you to compare stocks of different fruit within each shop.

Back to top of page

Gaps

Leave a slight gap between the bars. This makes it easier to tell the bars apart.

Leave a gap between clusters, slightly bigger than the width of a single bar. This makes it easier to compare the clusters.

Figure 2: Levels of fruit stock in four shops, fictional town, 2022, gaps labelled

Larger version of figure 2.

This clustered bar chart shows the same fictional data as in Figure 1 but with the gaps labelled.

Back to top of page

Adjacent colours

The colour contrast ratio between adjacent colours in charts needs to be at least 3 to 1. This includes the contrast of chart elements with the background colour.

For more information on colour contrast please see earlier modules in this e-learning or our colours guidance (link opens in a new tab).

Colour palette for categorical data

It is always possible for categorical data shown in clustered bar charts to have at least a 3 to 1 colour contrast ratio between all adjacent colours. The small gaps between the bars within the clusters also help.

See figure 1 for an example of a clustered bar chart using our colour palette for categorical data. All adjacent colours in this example have at least a 3 to 1 contrast ratio.

Colour palette for focus charts

Sometimes it is easier to get a message across by focusing on one series.

Figure 3: Levels of apple stock in four shops compared with three other fruits, fictional town, 2022

Apples are represented by the first bar in each cluster.

Larger version of figure 3.

This clustered bar chart shows fictional data about apple stock in four shops. It uses our colour palette for focus charts.

The first bar in each cluster is dark blue, the rest are a light grey. This allows us to focus on one series in comparison to the others.

You should not specify what each of the grey bars are showing. They are there for general comparison. It will not be possible for users to match labels to bars.

However, the light grey does not have a high enough colour contrast ratio with the white background. This means, to meet the relevant accessibility success criteria, this approach should only be used when essential to communicate a message.

Colour palette for sequential data

Sometimes our data requires a sequential palette.

Figure 4: Number of shoppers entering four shops on a given day, by age group, fictional town

The legend is the same order as the bars in each cluster.

Larger version of figure 4.

The figure shows a clustered bar chart of fictional data on shoppers. Each cluster represents a shop and each bar a different age group.

It makes sense to use a sequential colour palette for this data because the categories are related. We have used the colour palette for sequential data from our colours guidance (link opens in a new tab).

When we use this palette we need to remember that neither the dark or light blue have a high enough contrast ratio with the mid blue to meet the contrast ratio requirements. Also, the light blue does not have a high enough contrast ratio with the white background.

To help people use this chart we have:

  • left a small gap between the bars within each cluster
  • outlined each bar with the dark blue colour – this helps people identify the size of the bars even if they cannot see the light blue colour

Note: we only recommend outlining the bars when using this palette, in general, bar outlines add unnecessary clutter. We outline all bars on the chart for consistency.

Back to top of page

Legends

Matching data labels to bars using colour or shape is problematic for some users who may find it hard to see and/or differentiate between colours and shapes.

This is why legends tend to fail the Web Content Accessibility Guidelines (WCAG). See earlier modules of this e-learning for more information on WCAG.

This means we should try to avoid using legends. When we have to use them we should make them easier to use.

Option 1: Label the first cluster

If labels are suitable in length you can label the bars in the first cluster directly.

Figure 5: Number of each fruit bought in four shops, fictional town, 2022 (first cluster labelled)

Link to full size image of figure 5.

This figure shows a horizontal clustered bar chart showing fictional data on the numbers of apples, bananas, pears and pineapples bought in four shops. There is no legend but each bar in the first cluster is labelled directly.

This means the label is matched to the data series using placement instead of relying on colour.

However, the suitability of this approach depends on the length of your labels. If they are too long they may not fit or may add a lot of clutter.

Option 2: State the layout of the legend

If you have to use a legend, make sure:

  • the legend has the same order and orientation as the bars in the clusters
  • this information is stated in the text that comes directly before the chart

Figure 6: Number of each fruit bought in four shops, fictional town, 2022 (legend explained)

The legend is presented in the same order as the bars in each cluster.

Larger version of figure 6.

This figure shows a horizontal clustered bar chart showing fictional data on the numbers of apples, bananas, pears and pineapples bought in four shops. The legend is in the same order and orientation as the bars in each cluster. This is stated under the chart title.

This means a user should be able to match the label to the data series without relying solely on colour.

Option 3: Change the chart

Consider opting for a different type of chart that avoids the use of legends. For example a set of small multiples.

Figure 7: Number of each fruit bought in four shops, fictional town, 2022 (small multiples option)

Larger version of figure 7.

This figure shows four small bar charts. Each shows fictional data on a particular fruit: apples, bananas, pears and pineapples.

This presentation allows us to compare the fruit levels more easily. The clustered bar chart version (shown elsewhere in this module) allows us to compare the shops more easily.

Which you choose depends on the message you want to get across.

Producing small multiples

If you do want to make “small multiple” charts they can be made using Microsoft Office programs or in programs like R.

You should make sure each chart is the same size and has the same minimum and maximum on the y-axis. Also ensure the charts are spaced out evenly in a grid.

Only one chart in each row needs to have y-axis labels – this reduces visual clutter.

Back to top of page

Exercise

Back to top of page

Quiz

Try these questions to test your knowledge from this module

 

Download a plain text version of module 6 quiz (ODT, 8KB)

End of module 6

Next, module 7: Stacked bar charts

Back to landing page.

Back to top of page
  • If you would like us to get in touch with you then please leave your contact details or email Analysis.Function@ons.gov.uk directly.
  • This field is for validation purposes and should be left unchanged.