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 を使用できます)。次のコマンドでスクリプトを実行します。