import matplotlib.pyplot as plt
## Data for plotting
x = [2018, 2019, 2020, 2021, 2022]
y = [10, 12, 15, 18, 22]
## Create the plot
plt.plot(x, y)
## Add x-axis label
plt.xlabel("Year")
## Add y-axis label
plt.ylabel("Population (in millions)")
## Save the plot to a file
plt.savefig("line_plot.png")
现在,在 WebIDE 中打开一个终端(你可以使用终端面板中的 + 图标或菜单 Terminal > New Terminal)。使用以下命令运行你的脚本: