How to plot multiple lines in Matplotlib

You can easily plot multiple lines in Matplotlib with the following code. If you want to learn Python then I will highly recommend you to read This Book.

How to plot multiple lines in Matplotlib
How to plot multiple lines in Matplotlib

Plot Multiple Lines in Matplotlib

from matplotlib import pyplot as plt

x = [1,2,3,4,5]
y = [5,10,15,20,25]
z = [10,20,30,40,50]

plt.title("Numbers and Products")
plt.xlabel("Numbers")
plt.ylabel("Products")

plt.plot(x,y)
plt.plot(x,z)

plt.show()
Plot Multiple Lines in Matplotlib

People are also reading:

Best Python Books

What is Computer Vision? Examples, Applications, Techniques

Top 10 Computer Vision Books with Python

Books for Machine Learning (ML)

Free Learning Resources

Leave a Comment

Your email address will not be published.