Visualization In Python III: Area graph, pie chart, stacked chart

Abhijeet Srivastav
4 min readJun 29, 2020

Hey good to see you back, I hope you are following the previous articles if not you should check them out, its not necessary to know those topics for this tutorial but it will surely increase your knowledge.

Well know lets continue from where we left off.

Composition Plots

Composition plots are ideal if you think about something as a part of a whole. For static data, you can use pie charts, stacked bar charts, or Venn diagrams. Pie charts or donut charts help show proportions and percentages for groups. If you need an additional dimension, stacked bar charts are great. Venn diagrams are the best way to visualize overlapping groups, where each group is represented by a circle. For data that changes over time, you can use either stacked bar charts or stacked area charts.

1. Pie Chart

Pie charts illustrate numerical proportions by dividing a circle into slices. Each arc length represents a proportion of a category. The full circle equates to 100%. For humans, it is easier to compare bars than arc lengths; therefore, it is recommended to use bar charts or stacked bar charts the majority of the time.

To compare items that are part of a whole.

The following diagram shows :

Pie chart showing household water usage around the world

Design Practices

  • Arrange the slices according to their size in increasing/decreasing order, either in a clockwise or counterclockwise manner.
  • Make sure that every slice has a different color.

2. Variants: Donut Chart

An alternative to a pie chart is a donut chart. In contrast to pie charts, it is easier to compare the size of slices, since the reader focuses more on reading the length of the arcs instead of the area. Donut charts are also more space-efficient because the center is cut out, so it can be used to display information or further divide groups into subgroups.

Basic donut chart and Donut chart with subgroups

Design Practice

Use the same color that’s used for the category for the subcategories. Use varying brightness levels for the different subcategories.

3. Stacked Bar Chart

Stacked bar charts are used to show how a category is divided into subcategories and the proportion of the subcategory in comparison to the overall category. You can either compare total amounts across each bar or show a percentage of each group. The latter is also referred to as a 100% stacked bar chart and makes it easier to see relative differences between quantities in each group.

The following diagram shows a bar chart with five groups:

Generic stacked and 100% stacked bar chart
Total sales of non-smokers are stacked on top of the daily total sales of smoker in resturant

Design Practices

  • Use contrasting colors for stacked bars.
  • Ensure that the bars are adequately spaced to eliminate visual clutter. The ideal space guideline between each bar is half the width of a bar.
  • Categorize data alphabetically, sequentially, or by value, to uniformly order it and make things easier for your audience.

4. Stacked Area Chart

Stacked area charts show trends for part-of-a-whole relations. The values of several groups are illustrated by stacking individual area charts on top of one another. It helps to analyze both individual and overall trend information.

To show trends for time series that are part of a whole.

Diagram shows a stacked area chart with the net profits of Google, Facebook, Twitter, and Snapchat over a decade.

Design Practice

Use transparent colors to improve information visibility. This will help you to analyze the overlapping data and you will also be able to see the grid lines.

In this article, we covered various composition plots and we will continue the rest topics in next article, so stay tuned.

For more awesome content and regular posts you can connect with me on Instagram😍

--

--

Abhijeet Srivastav

CEO Techneophyte | Python Developer | ML Engineer | Data Scientist | Flutter Developer | Penetration Tester | Software Engineer at Infosys