# How to Make Stacked Bar Graph – Definition, Advantages & Examples

This post is also available in: हिन्दी (Hindi)

A stacked bar chart or a stacked bar graph or a composite bar graph is a visual representation of the parts of a whole and is often used to compare the parts. Its appearance is similar to that of an ordinary bar graph. Stacked bar charts are an incredibly effective tool for comparisons when used correctly. They are designed to compare total values across categories.

Let’s understand what is a stacked bar graph and how is it read and drawn using examples.

## What is a Stacked Bar Graph?

The stacked bar graph(or composite bar graph) divides the whole bar into different parts. In this, each part of a bar is represented using different colors to easily identify the different categories. It requires specific labeling to indicate the different parts of the bar. Thus, in a stacked bar graph every rectangular bar represents the whole, and each segment in the rectangular bar shows the different parts of the whole.

Similar to a bar graph, a stacked bar graph is also drawn over two axes. The $x$-axis of a stacked bar graph shows the categories being compared, and the $y$-axis represents the scale. A scale is a set of numbers that represents the data organized into equal intervals. The title of the stacked bar graph provides a general overview to the reader of what is being measured and compared. A stacked bar graph also has a key. The key for a stacked bar graph represents the groups being compared with two separate colours or shades.

The graph shown above is a vertical stacked bar graph.

The stacked bar graph can also be a horizontal stacked bar graph. In the case of a horizontal stacked bar graph, the $x$-axis represents the scale showing the data and the $y$-axis shows the categories being compared.

The graph shown above is a vertical stacked bar graph.

The stacked bar graph can also be a horizontal stacked bar graph. In the case of a horizontal stacked bar graph, the $x$-axis represents the scale showing the data and the $y$-axis shows the categories being compared.

## When You Should Use a Stacked Bar Graph

The main objective of a standard bar chart is to compare numeric values between levels of a categorical variable. One bar is plotted for each level of the categorical variable, each bar’s length indicating a numeric value. A stacked bar chart also achieves this objective but also targets a second goal.

We want to move to a stacked bar chart when we care about the relative decomposition of each primary bar based on the levels of a second categorical variable. Each bar is now comprised of a number of sub-bars, each one corresponding with a level of a secondary categorical variable. The total length of each stacked bar is the same as before, but now we can see how the secondary groups contributed to that total.

## How to Read a Stacked Bar Graph

The different steps to make a stacked bar graph are given below:

Step 1: Check whether the given stacked bar graph is a horizontal double bar graph or a vertical stacked bar graph.

Step 2: In the case of a vertical stacked bar graph, the categories are present on the horizontal axis (or x-axis) and the data values are represented by the vertical bars(or rectangles).

In the case of a horizontal stacked bar graph, the categories are present on the vertical axis (or y-axis) and the data values are represented by the horizontal bars(or rectangles).

Step 3: For each category,

In the case of a vertical stacked bar graph note down the point on the $y$-axis corresponding to the height of a vertical bar

In the case of a horizontal stacked bar graph note down the point on the $x$-axis corresponding to the length of a horizontal bar

Step 4: In the case of stacked bar graphs, the values represented by the bars are cumulative, and hence to get the exact value subtract the corresponding number from the previous one.

For example, if category 1 corresponds to 15, category 2 corresponds to 20 and category 3 corresponds to 45, then values corresponding to each category are

Category 1: 15 – 0 = 15

Category 2: 20 – 15 = 5

Category 3: 45 – 20 = 25

### Examples

Let’s consider an example to understand how a stacked bar graph is read.

Ex 1: Observe the stacked bar graph and answer the following questions.

• How many students play cricket?
• Which of the most preferred game for class 9?
• Which games are played equally by students class-wise?
• How many students in class 9 play basketball?
• What is the difference in the number of students playing tennis in class 8 and class 10?

The top of the bar for cricket is in line with 35, therefore the total number of students playing cricket is 35.

For class 9, the rectangle corresponding to basketball has a maximum height, therefore, the most preferred game for class 9 is basketball.

For football and basketball, the total height of the bar is equal which is 30. Similarly, for tennis and cricket, the total height of the bar is equal which is 35. Therefore, football and basketball are played by an equal number of students, and tennis and cricket are played by an equal number of students.

The number of students in class 9 playing basketball is 20.

The number of students in class 8 playing tennis is $10 – 0 = 10$.

The number of students in class 10 playing tennis is $35 – 25 = 10$.

## How to Make Stacked Bar Graph

The different steps to make a stacked bar graph are given below:

Step 1: Make a data-filled table

Step 2: Draw the horizontal axis and vertical axis. (For example, Favourite Food)

Step 3: Now, label the horizontal axis.

Step 4: Write the names on the horizontal axis, such as Pizza, Noodles, Pasta, and Burger.

Step 5: Now, label the vertical axis. (For example, Number of Students)

Step 6: Finalise the scale range for the given data. If the number 45 is the highest value while 0 is the lowest. This graph should be scaled such that 1 unit equals 5 students.

Step 7: Finally, draw the bar graphs that should represent each category of the fruit with their respective numbers. For each category draw the rectangles one above the other with the height corresponding to the number represented.

### Examples

Ex 1: Given below is the data showing the favorite fast food of boys and girls of a class. Draw a Stacked Bar graph representing the given information.

The first step is deciding the title of the bar graph. Let’s name our bar graph “Favourite Fast Food of Students”.

Next, draw the axes.

The horizontal axis represents the activity and the vertical axis represents the number of students.

To choose an appropriate scale, note down the maximum values for all the categories in the data set and add them.

The maximum value for both the categories is (Number of boys for noodles = 35 and Number of girls for noodles = 30). Therefore, the maximum value will be 35 + 30 = 65.

Since the maximum value is 65, so let’s mark the maximum point on the vertical axis as 70 starting from 0 with equal intervals of 10. This will fit all the values properly in the bar graph.

Finally, draw the bar graph that should represent each category of the activity with their respective numbers.

## Practice Problems

1. Draw a Stacked Bar Graph to compare the favorite ice cream flavors of girls and boys in a class.

2. Draw a stacked bar graph to compare the marks of the students in practice tests and tests.

3. Draw a stacked bar graph to compare the number of boys and girls in different classes.

## FAQs

### What is a stacked graph used for?

Stacked Bar Graphs are used to show how a larger category is divided into smaller categories and what the relationship of each part has on the total amount.

### How do you analyze a stacked bar graph?

As with an unstacked bar chart, judge the absolute length of each bar by cross-referencing against the scale along an axis or a value label. Use the grid lines to compare the parts of the stack against one another.

### What is an advantage of a stacked bar graph?

When you need to compare data points, it is often easier to see the comparison on a stacked bar graph versus a combined graph. You can see data points more clearly when they are on top of each other, and you can quickly see the percentage of each data point compared to the total value.

## Conclusion

The stacked bar graph(or composite bar graph) divides the whole bar into different parts. In this, each part of a bar is represented using different colors to easily identify the different categories. The main advantage of stacked bar graphs is that you can see data points more clearly when they are on top of each other, and you can quickly see the percentage of each data point compared to the total value.