Plotting Multiple Bar Chart together - Pyplot of Mathplotlib

Plotting Multiple Bar Chart together - Pyplot of Mathplotlib

Instructor-svgAl-Mamun Sarkar
Apr 02 , 2020

Plotting Multiple Bar Chart together - Pyplot of Mathplotlib. The following codes shows how to plot multiple bar chart using pyplot of python mathplotlib module.

 

Import Module:

import matplotlib.pyplot as plt

 

Create data and plot multiple bar chart together:

x_data = [2, 4, 6, 8, 10]
y_data = [6, 7, 8, 2, 4]

another_x = [1, 3, 5, 7, 9]
another_y = [7, 8, 2, 4, 2]

plt.bar(x_data, y_data, label='Bars1')
plt.bar(another_x, another_y, label='Bars2')
plt.title("Welcome to bar chart ploting \n Check it out")
plt.xlabel('Plot Number')
plt.ylabel('Important Var')
plt.legend()
plt.show()

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram