Skip to main content

Matplotlib: Bar Plot

Bar chart is a type of a graph which can represent categorical data with a rectangular bars in which height is proportional to the values that we want to represent. In this graph one axis represent the specfic categories which we want to compare and other is used to represent measured values of those categories.

It can be plotted horizontally and vertically. Here vertical bar chart is offten reffered as column chart.

It can describe the comparisons between discrete categories.

Syntax, height, width=0.8, bottom=None, *, align='center', data=None, **kwargs)


  • x: It implies x co-ordinates of the bars.
  • height: It is used for height of the bars.
  • bottom: The y co-ordinate of the bars.
  • align: It is used for alignment.


import numpy as np
import matplotlib.pyplot as plt

# creating the datasets
fig = plt.figure(figsize = (10, 5))

#creating bar plot, marks, color ='blue', width = 0.5)
plt.title("Student Marks")


bar plot

Submitted by devanshi.srivastava on November 25, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.