Python Line Chart Basics
plt.plotPractice

Connect points to show a trend

Press Run to plot each (x, y) point, then connect them in order — the same steps as plt.plot.

Picture this: connect the dots

Each (x, y) is a point. The line shows the trend.

x listacross
→
y listup
→
plt.plotconnect
→
linetrend

In easy words

Matplotlib walks the two lists together and draws segments between consecutive points.

Where this is used

Temperature over hours, stock close over days, accuracy over epochs.

Run algorithm

Each step highlights the matching Python line. Program output appears only when a line that prints actually runs.

Ready
1import matplotlib.pyplot as plt
2x = [1,2,3,4]
3y = [2,4,1,5]
4plt.plot(x, y)
5plt.show()
Output:

Example Program

1import matplotlib.pyplot as plt
2x = [1,2,3,4]
3y = [2,4,1,5]
4plt.plot(x, y)
5plt.show()