Everything About Bar Chart and How To Construct Different Bar Charts Using Matplotlib In Python

TrainDataHub
4 min readApr 28, 2022

What is a bar chart?

A bar chart also known as bar graph is a chart that represents the categorical data with their numeric values. Numeric values are plotted on one chart axis and the categorical data are plotted on the other chart axis.

What is bar chart used for?

A bar chart is used for CATEGORICAL data such as cities, countries, names, music genres, etc along with other numerical features. Bar charts are best used when we want to show the comparison between different groups of the categorical data.

Here’s the example of the bar chart. We want to show the score’s comparison by different subjects (which subject has highest score, which has lowest, etc). Our data frame include categorical data (Subject) and numeric column (Score).

Types of Bar Charts

There are different types of bar charts as listed as below.

  1. Vertical Bar Chart (Most Commonly Used)
  2. Horizontal Bar Chart
  3. Grouped Bar Chart
  4. Stacked Bar Chart
  5. Vertical Bar Chart
plt.figure(figsize=(6,4))plt.bar(df['Subject'],df['Score']…

--

--