2808 explained code solutions for 75 technologies


python-matplotlibHow to draw multiple lines


Plotting multiple lines is as simple as calling plt.plot() method multiple times. Let's plot 2 lines:

import matplotlib.pyplot as plt
plt.plot([1,2,10,6,15,3,4])
plt.plot([4,2,11,2,1,20,25])
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

[1,2,10,6,15,3,4]

values to use for first line

[4,2,11,2,1,20,25]

values to use for second line

.show()

render chart in a separate window