Stacked Bar Chart Overview

Abdulaziz Alsulami
3 min readMay 20, 2021

Stacked Bar Chart is a Bar Chart with subcategories for each bar.

Let us take an example to explain that with more details. This is the head of data frame, the first ten rows.

Let us see how many rows and features we have in the entire data?

Let us describe each feature (variable/ column)

The first feature is a Single test, let us see how many test we have in the data.

We have twenty one unique Single tests in our data. The next five features represent different stages, each stage consumed specific duration in minutes.

The question here.

Which chart is the appropriate one to display each single test with all its stages?

or in other way.

How can we compare between these stages for all tests in one graph ?

We should reduce the whole data to small data by compute the median or average value for each duration, then we get just one value for each stage in a single test. It means one row for each single test with one value (median / average value) for each stage.

Total observations = Five stages times twenty one tests = 5 x 21 = 105 durations

We computed the average time for each stage then, the data became twenty one indexes and five features.

We set single test feature (variable) as index instead of numbers.

Now we can plot the data in Stacked Bar Chart, one bar for each test with all stages. The total bars will equal total single tests (twenty one bars), each bar with five stages

As we saw in the above figure, we can compare each stage in single test as well as we can compare each stage in a single test with other stage in another test.

We can plot these data with Bar Chart instead of Stacked Bar Chart, let us see the figure.

The above figure Bar Chart is unclear but the figure of stacked Bar Chart is very clear so that, all stages of each single test combined in one bar and became an easy to compare each test with other.

Note:

With few categories for instance, five tests we can plot them in Bar Chart but with several categories more than ten and each category have subcategories as we saw in our data each single test has five stages Stacked Bar Chart was appropriated Chart for comparing between each test or each stages.

--

--

Abdulaziz Alsulami

A self Learner interested for AI & Python, love reading, write his thoughts to his own way and like presenting knowledge to world in picture which he like.