matplotlib plot two lines same graph code example
Example 1: python plot multiple lines in same figure
Call plt.plot() as many times as needed to add additional lines to plot.
import matplotlib.pylot as plt
x_coordinates = [1, 2, 3]
y1_coordinates = [1, 2, 3]
y2_coordinates = [3, 4, 5]
plt.plot(x_coordinates, y1_coordinates)
plt.plot(x_coordinates, y2_coordinates)
Example 2: python plot two lines on same graph
import matplotlib.pylot as plt
x_coordinates = [1, 2, 3]
y1_coordinates = [1, 2, 3]
y2_coordinates = [3, 4, 5]
fig = plt.figure(1)
plt.plot(x_coordinates, y1_coordinates)
plt.plot(x_coordinates, y2_coordinates)
plt.show()