plt.figure(figsize=(20, 20))
sns.scatterplot(X['freq'], X['sum'], hue=X['labels'],
palette=sns.color_palette('hls', 3))
plt.title('KMeans with 3 Clusters')
plt.show()
This is the result of the K-Means visualization:
centroids = kmeans.cluster_centers_
centroids_x = centroids[:,0]
centroids_y = centroids[:,1]
plt.scatter(centroids_x,centroids_y,marker = "x", s=150,linewidths = 5, zorder = 10, c=['black', 'black','black'])
This is the result of the cluster centroids:
fig, ax = plt.subplots(1,2, figsize=(20, 20))
ax[0].plt.scatter(centroids_x,centroids_y,marker = "x", s=150,linewidths = 5, zorder = 10, c=['black', 'black','black'])
sns.scatterplot(X['freq_jeu'], X['sum_total'], hue=X['labels'], ax=ax[1])
But I get the error:
AttributeError: 'AxesSubplot' object has no attribute 'plt'
ax[0].scatter(...), remove theplt- DavidG