画3d图
程序员文章站
2024-01-19 13:47:40
...
from mpl_toolkits.mplot3d import Axes3D
plt.figure(figsize=(10,8))
#gca = get current axes
axes = plt.gca(projection='3d')
axes.scatter3D(data[:,0], data[:,1], data[:,2], s=200, c=kmeans.labels_) # s是size的意思
axes.scatter3D(centers[:,0], centers[:,1], centers[:,2], s=400, alpha=0.5, cmap='rainbow', c=[0,1,2])
下一篇: Number of Islands