Python 3 Matplotlib Library Script to Plot a Bar Graph From Points DataFrame Full Project For Beginners

Python 3 Matplotlib Library Script to Plot a Bar Graph From Points DataFrame Full Project For Beginners

 

Welcome folks today in this blog post we will be plotting a bar graph in python using matplotlib library. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following matplotlib library using the pip command as shown below

 

pip install matplotlib

 

After installing this library you need to make an app.py file and copy paste the following code

See also  Python 3 pdfrw Library Tutorial to Concatenate Multiple PDF Documents Together Full Project For Beginners

 

app.py

 

from matplotlib import pyplot as plt 
  
# x-axis values 
x = [5, 2, 9, 4, 7] 
  
# Y-axis values 
y = [10, 5, 8, 4, 2] 
  
# Function to plot the bar 
plt.bar(x,y) 
  
# function to show the plot 
plt.show()

 

 

And now if you execute the above python script by typing the below command as shown below

See also  Python 3 wxPython Basic Arithmetic Calculator GUI Desktop App Full Project For Beginners

 

python app.py

 

Leave a Reply