How to plot multiple graphs in Python

In this article, we will learn to plot multiple graphs in the same figure in Python. We are using Matplotlib for this.
import matplotlib.pyplot as plt x1 = [1, 1.5, 4] y1 = [4, 4, 2] x2 = [1, 3, 5] y2 = [2, 8, 6] plt.plot(x1,y1) plt.plot(x2,y2) plt.show()
Output:

Subscribe
Login
Please login to comment
0 Discussion