2017-02-25 97 views

回答

2

你必須標記你的價值觀這等於一個情節:

import matplotlib.pyplot as plt 
import numpy as np 

# test data 
t = np.linspace(0, 2 * np.pi, 30) 
x = np.sin(t) 
x[3] = 1 
y = np.cos(t) 

# indices for 'bad' values 
indices = x == 1 
# calc colors from jet cmap 
cmap = plt.get_cmap('jet') 
colors = cmap((y - y.min())/y.ptp()) 

# normal values 
plt.scatter(t[~indices], x[~indices], c = colors[~indices], cmap = cmap) 
# bad values 
plt.scatter(t[indices], x[indices], c = 'grey') 
plt.show() 

enter image description here

陣列T,X,Y代表熊貓系列。

+0

完美的作品!非常感謝。 – MattnDo

相關問題