2017-08-15 247 views

回答

1

您可以用同樣的方法matplotlib.pyplot.setp()指定每行的屬性,以及:

import matplotlib.pyplot as plt 
import numpy as np 

x = np.arange(0, 1.0, 0.01) 
y1 = np.sin(2*np.pi*x) # function 1 
y2 = np.sin(4*np.pi*x) # function 2 
lines = plt.plot(x, y1, x, y2) 

l1, l2 = lines # split lines  
plt.setp(l1, linewidth=1, color='r', linestyle='-') # set function 1 linestyle 
plt.setp(l2, linewidth=1, color='g', linestyle='-') # set function 2 linestyle 

plt.show() 

輸出:

enter image description here

+0

LiamG_G是,你是怎麼想? – manelfp

+0

是的,對不起。今天還沒回來呢。謝謝! –

相關問題