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

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

 

Welcome folks today in this blog post we will be plotting a line 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

 

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 
plt.plot(x,y) 
  
# function to show the plot 
plt.show()

 

See also  Python 3 Create and Save JSON File Using JSON Module | Converting Python Objects to JSON Objects Full Tutorial For Beginners

 

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

 

python app.py

 

Leave a Reply