Module 10

First plot

A simple line chart.

Your first chart

The plot() function creates a line chart. You provide x values and y values.

Python
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [10, 20, 15, 25]
plt.plot(x, y)
plt.savefig("chart.png")
print("Chart saved")
Chart saved
Your task

First plot

  • Plot x=[1,2,3], y=[10,20,15] and save.