Introduction
Bar charts are one of the simplest, yet most powerful ways to visualise data, whether you're comparing categories, tracking trends over time, or just trying to make sense of some numbers.They're the go-to visualisation for many because they’re so easy to read at a glance and can be customised to fit nearly any data set.
In this guide, we’re going to walk you through everything you need to know about these charts. We’ll start with the basics – what they are and when to use them – then dive into the different types, like stacked and grouped bar charts, and how to make your charts more effective.
What is a bar chart?
A bar chart is a simple way to visually compare different things using bars. Each bar represents a category or group, and the length of the bar shows how much or how many of something there is. The longer the bar, the bigger the value. For example, if you’re comparing sales of different products, each product gets its own bar, and the bar’s length shows how many units were sold.
It’s a super straightforward way to look at data and quickly spot which category is the biggest or smallest. Bar charts are great when you want to make comparisons across different groups or see how things stack up.
Elements of a bar chart
For a bar chart to work, it should contain at least 2 variables – a primary variable, called a categorical variable, and a secondary variable, which is numeric.
The primary variable has to be discrete. Non-categorical variables can be used when they are converted into groups, which will then be used as categorical variables. For if the variable is a date, the dates can be grouped by week, month, quarter or year.
A bar chart has many key elements:
- Bars: The bars are the stars of the chart! Each one represents a category, and the length or height of the bar shows the value. Taller (or longer) bars mean bigger values.
- X-Axis and Y-Axis: For vertical bar charts (column charts), the X-axis shows categories or groups and the Y-Axis shows numerical values. In horizontal bar charts, it’s the opposite.
- Axis Labels: The little labels next to the X-axis and Y-axis that tell you what you’re looking at.
- Title: A clear heading at the top which explains what the chart is about.
- Gridlines (optional): Light lines across the chart that help you line up the bars with their values, making it easier to read.
- Legend (optional): If you're using stacked or grouped bars, the legend shows you what the different colours or patterns mean.
- Data Labels (optional): Some charts include numbers right on the bars, showing the exact value, so you don’t have to guess.
- Baseline: This is where the bars start, usually at zero, so you can make accurate comparisons between categories.
- Colours: Colours help you quickly spot differences between categories or make the chart look nicer and easier to understand.
Figure 1 - Anatomy of a Bar Chart
When should you use a bar chart?
A bar chart is probably the most commonly used visualization, and for good reason. Bar charts are the default choice to compare different categories or groups easily and showing frequency distribution. Bar charts can also be used to show trends over time, but there are often better choices for that purpose.
Figure 2 - Total page views for each month
The values of the numerical variable can be many things, such as
- Total
- Average (mean, median, mode)
- Frequency
- Percentage
Figure 3 - Average Transaction Value for Each Method of Payment
This chart shows the average transaction amount. If you had to plot how often customers used each method of payment, or the total transaction amount, it would be a very different picture.
Stacked Bar Chart
A stacked bar chart is like its regular counterpart, but instead of each bar showing just one value, it’s divided into different parts (or "stacks"). Each stack represents a sub-category within the main category, and all the stacks add up to the total value of the bar.
For example, if you're showing sales by region, a regular bar might just show total sales for each region. But with a stacked bar chart, you can break that down further, like showing how much each product contributed to the total sales in that region. Each product gets its own colour, and they stack on top of each other in the bar.
It’s a handy way to see both the total value and how different parts make up that total, all in one bar. You can quickly compare not just the overall size of each category, but also the contribution of each sub-category.
Figure 4 - Stacked Column Chart
Another variation for the stacked bar chart is the percentage stacked bar chart, or the 100% stacked bar chart. This means we can’t compare the total values of the main categories anymore, but we can get a clearer view of how the secondary groups are distributed. These charts are ideal when the total is constant or not relevant, and when the proportion is important.
Figure 5 - A 100% stacked bar chart
Grouped Bar Chart
A grouped bar chart is an easy way to compare different categories side by side. Instead of having just one bar for each category, you have several bars grouped together for each one. Each bar in the group represents a different sub-category.
For example, let’s say you’re looking at the sales of different fruits in various months. Instead of just one bar showing total sales for each fruit, you’d have a group of bars for each fruit—one for January, one for February, and so on. This way, you can easily compare how each fruit sold in each month right next to each other.
Grouped bar charts make it super simple to see patterns and differences across multiple categories at a glance, which is really handy when you want to dig deeper into the data.
Stacked bar chart (left) and grouped bar chart (right)
Lollipop Chart
This chart is just cosmetically different from a bar chart. Instead of using bars, a lollipop chart has lines with dots at the ends. It's really helpful when there are many categories with similar values. The different design makes it easier to read and understand compared to regular bar charts.
Figure 6 - A lollipop chart (right)
Bar vs Column chart
While bar and column charts essentially serve the same purpose, there is a notable difference between them, and when to use each of them.
Bar charts display categories on the vertical axis and values on the horizontal axis.
Column charts display categories on the horizontal axis and values on the vertical axis.
Use column charts when
- You have 10 or less categories
- Your chart includes negative values
- You want to display trends over time
Use bar charts when
- You have more than 10 categories
- Your category labels are long
Best Practices
- Start at Zero: Always start the y-axis (or x-axis in horizontal charts) at zero to avoid misleading interpretations of the data. This ensures that the length of the bars accurately reflects the values.
Figure 7 - A Misleading Bar Chart
In Figure 7, you can see how a small difference is made to look bigger than it is due to the lack of a zero baseline.
- Maintain rectangular forms for your bars: Avoid using 3D effects and excessive rounding.
Figure 8 - Rectangles are the best form
- Limit the number of categories: Try to keep the number of bars manageable. Too many categories can make the chart cluttered and hard to read. If you have many categories, consider grouping them or using a different type of chart.
- Colours: Make sure you use the right colour combination so that the graph looks visually appealing, or at the very least not an eye-sore. Use colours only when required.
- Ordering: The standard convention is to sort the bars from largest to smallest. This reduces the burden on the reader to make comparisons. However, if the categories are inherently ordered, that takes precedence.
- Bar Size and Spacing: Make sure the bars are appropriately sized and spaced well together, depending on the size of your visualization.
- Stay clear of using images: If your choice of symbol scales both width and height with value, differences will look much larger than they actually are, since people will end up comparing the areas of the bars rather than just their widths or heights.
Bar Chart Options
Value Annotations
Annotations are extra labels or markers that highlight certain data points, trends, or specific areas. They’re great for adding context or pointing out important details that might not stand out at first glance from just looking at the chart.
We can see 2 methods of value annotation in this chart. These values can also be placed in the middle of the bars.
Reference lines
Reference lines are simple markers that highlight certain values or thresholds. They act as benchmarks, making it easier to compare data points or check if you're hitting targets.
Reference lines could be of many values, some of the most common include mean or median, targets and limits.
Reference lines provide quick insights to how data compares to important thresholds or goals, enhances context and improves readability.
Variability Whiskers
Variability whiskers(often called error bars) show how much the data can vary. They're little lines that stick out from the top or bottom of each bar and give you a sense of the range or uncertainty around the data point. So, if you're looking at a chart with whiskers, they help you see how spread out the data might be or how confident you can be about the numbers. Essentially, they show the possible highs and lows, giving you more context beyond just the bar itself.
If variance is your focus, consider box plots or violin plots, which illustrate the distribution of values better.
Colours
A single colour is most suitable when comparing the heights of the bars.
Use multiple colours when differentiating categories and sub-categories. Remember to choose colours that work well together.
Gradients are occasionally used to show a range or progression in data values.
Legends
Legends help explain what different colours, patterns, or groupings in the chart represent. If you're using multiple colours or have grouped or stacked bars, a legend makes it clear what each bar or section stands for. For example, if you have sales data split by regions, the legend would show which colour represents each region.
Conclusion
In conclusion, bar charts are one of the simplest yet most effective tools for visualising data. They make it easy to compare values at a glance and can be customised in a bunch of ways to fit your needs. Whether you're tracking performance, showing trends, or just breaking down numbers, they do the job without much fuss. With options like stacked bars, reference lines, and annotations, you can make your chart as detailed or straightforward as you need.