使用VS code開發Python程式 - Matplotlib繪圖

這一篇為如何在VS code的IDE 中用python開發matplotlib,

程式碼如下:

#%%
from matplotlib import pyplot as plt
import numpy as np

x = np.linspace(1, 10, 20)
print(x)
y = 3 * x + 2
fig = plt.figure()
axes = fig.add_axes([0.1, 0.1, 0.9, 0.9])
axes.plot(x, y, 'r')

plt.show()

#%%

使用#%%會出現Run Cell字樣,按下Run Cell,可以執行Python Interactive視窗,

留言

這個網誌中的熱門文章

使用Pycharm開發Python程式與用Matplotlib繪圖

[Python][tkinter] Build tkinter GUI 使用tkinter建立圖形視窗