我正在创建一个3D散点图,该散点图是使用PCA(3个组件)转换数据的结果。我希望我的数据根据变量“phi”进行颜色编码,这是一个浮动数组,范围为0-360度。 变量x:[44520,3],φ[44520,1]
我得到以下错误:
ValueError: 'c' argument has 44520 elements, which is not acceptable for use with 'x' with size 44520, 'y' with size 44520.
有什么线索吗
signalt = dfonf.T # transpose the data as the cell #s are the features and the sampled data is the sample
pca = PCA(n_components=3)
x = pca.fit_transform(signalt)
fig = plt.figure(figsize=(10, 10))
ax = plt.axes(projection="3d")
pcaplot = ax.scatter3D(x[:,0],x[:,1],x[:,2],c=phi,s=0.2)
cbar = fig.colorbar(pcaplot)
变量c不能是二维的,使用
np.squeeze(phi)
这把它修好了
相关问题 更多 >
编程相关推荐