用相同的颜色绘制每个簇

问题描述 投票:0回答:1

我是非常新的机器学习python我试图使我的输出的每个集群与不同的颜色这里是代码。

mean = (1, 2)
cov = [[1, 0], [0, 1]]
x1, y1 = np.random.multivariate_normal(mean, cov, 500).T

mean = (10, 2)
cov = [[1, 0], [0, 1]]
x2, y2 = np.random.multivariate_normal(mean, cov, 500).T

mean = (5, 5)
cov = [[1, 0], [0, 1]]
x3, y3 = np.random.multivariate_normal(mean, cov, 500).T

aa = [x1,x2,x3]
bb = [y1,y2,y3]


plt.plot(aa, bb, 'x')
plt.axis('equal')
plt.show()

这是我得到的输出

output

我需要每个簇有相似的颜色,但不是全部相同。

python matplotlib machine-learning plot cluster-analysis
1个回答
2
投票

你的意思是。

plt.plot(x1,y1, 'x')
plt.plot(x2,y2,'x')
plt.plot(x3,y3, 'x')
plt.axis('equal')
plt.show()

输出:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.