我有一个二维数据框。i、 e
data = [[ 7.08535569 5.20423916]
[ -6.12292297 -9.79831639]
[ -0.14405156 0.02112219]
...
[ -2.93838878 2.4744518 ]
[ 8.07134259 -10.8165695 ]
[ 5.14161567 2.68737039]]
我还为每个索引设置了一个目标值,即
target = [-1, 1, 1, -1 ... -1, 1, -1, -1]
使用PyPlot根据点的目标值对点进行颜色编码的最简单方法是什么
目前我有
X = data[:,0]
y = data[:,1]
plt.plot(X, y, 'ro')
plt.show()
使用
scatter
,它接受颜色映射的其他参数:参考资料:
Matplotlib scatterplot; colour as a function of a third variable
相关问题 更多 >
编程相关推荐