Plotting Bar Charts - Pyplot of Mathplotlib module

Plotting Bar Charts - Pyplot of Mathplotlib module

Instructor-svg Al-Mamun Sarkar
Apr 02 , 2020

Plotting Bar Charts - Pyplot of Mathplotlib module. The following codes shows how to plot a bar chart using pyplot of python mathplotlib module.

 

Import Module:

import matplotlib.pyplot as plt

Create data and plot bar chart:

x_data = [2, 4, 6, 8, 10]
y_data = [6, 7, 8, 2, 4]
plt.bar(x_data, y_data, label='Bar Chart')
plt.title("Welcome to bar chart ploting tutorial \n This is Another Line")
plt.xlabel('Plot Number on X-Axis')
plt.ylabel('Important Var on Y-Axis')
plt.legend()
plt.show()

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