I am creating a 3D scatter plot resulting from transforming my data using PCA (3 components). I want my data to be color coded against variable 'phi', which is an array of floats , ranging from 0-360 degrees. variables x :[44520,3], phi[44520,1)
I get the following error:
ValueError: 'c' argument has 44520 elements, which is not acceptable for use with 'x' with size 44520, 'y' with size 44520.
Any clues?
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)
The variable c cannot be two dimensional, converted into 1D using
np.squeeze(phi)
This fixed it