python可视化

# 可视化
# 二维
import matplotlib.pyplot as plt
plt.scatter(data[:,0],data[:,1],c=labels)
plt.show()

# 三维
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(data[:,0],data[:,1],data[:,2],c=labels)
plt.show()

你可能感兴趣的:(笔记)