matplotlib--figure

matplotlib 的 figure 就是一個 單獨的 figure 小窗口, 小窗口裏面還可以有更多的小圖片.


import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-3, 3, 50) #X axis data
y1 = np.sin(x)*x**2 +1
y2 = np.sin(x)-1
y3 = -0.5*(x-0.1)**2+1

plt.figure()
plt.plot(x, y1)
plt.scatter(x, y1, c='r')

plt.figure(num = 2, figsize= (10,10),dpi=72)
plt.plot(x,y2)
plt.plot(x,y3, c='g', lw=2, linestyle='--')

plt.show()


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章