I have clustered 3 features Feature1, Feature2 and Feature3 and came up with 2 clusters. I am trying to visualize a 3D cluster using matplotlib.
In the below table, there are three features upon which the clustering is executed. Number of clusters is 2.
Feature1 Feature2 Feature3 ClusterIndex
0 1.349656e-09 1.000000 1.090542e-09 0
1 1.029752e-07 1.000000 6.040669e-08 0
2 2.311729e-07 1.000000 1.568289e-11 0
3 1.455860e-08 6.05e-08 1.000000 1
4 3.095807e-07 2.07e-07 1.000000 1
Tried this code:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = np.array(df['Feature1'])
y = np.array(df['Feature2'])
z = np.array(df['Feature3'])
ax.scatter(x,y,z, marker=colormap[kmeans.labels_], s=40)
However, I get the error "ValueError: could not convert string to float: red". The marker part is thus where I get the error.
2D visualization of clusters is pretty simple by plotting the points in a scatter plot and distinguishing it with cluster labels.
Just wondering is there a way to do 3D visualization of clusters.
Any suggestions would be highly appreciated !!

colormapand what iskmeans.labels_?