В python я построил свои кластеры на графике рассеяния.
Однако, независимо от того, какое значение я изменил на свой ylim (,), ось y все еще показывает от 0 до 6. Кто-нибудь знает почему? И как я могу увеличить, чтобы увидеть точку вокруг [0, 2] * [0, 2]?
Спасибо!
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=7, random_state=0).fit(X)
plt.figure(figsize=(5,5))
trueK = 7 # Desired number of clusters
colors = 'bgrykcm' # the letters are defining colors for each K. For instance, b is blue and g is gray.
plt.subplot(1,2,2)
for J in range(trueK):
X_J = X[kmeans.labels_==J]
plt.title("Clusters")
plt.scatter(X_J[:, 0], X_J[:, 1], c=colors[J], s=10)
plt.xlim(0,2)
plt.ylim(0,2)
plt.axis('equal')
plt.show()
- По оси Y все еще отображается от 0 до 6.
![edit note the scale in graphic do not show in image link](https://i.stack.imgur.com/pin0n.png)