JUNGU commited on
Commit
26cdcf1
·
1 Parent(s): b46415a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -37,17 +37,17 @@ def main():
37
  "인구밀집도": population_df
38
  }
39
 
 
 
40
  fig, ax = plt.subplots(figsize=(8, 8))
41
- for dataset_name in datasets:
42
- data = dataset_mapping[dataset_name]
43
- centroids, labels = apply_kmeans(data.values, k_value)
44
-
45
- ax.scatter(data['x'], data['y'], label=dataset_name, cmap='viridis')
46
- ax.scatter(centroids[:, 0], centroids[:, 1], s=200, c='red', marker='X')
47
  ax.set_xlim(0, 100)
48
  ax.set_ylim(0, 100)
49
  ax.set_title(f"K-means clustering result (k={k_value})")
50
- ax.legend()
51
  st.pyplot(fig)
52
 
53
  if __name__ == "__main__":
 
37
  "인구밀집도": population_df
38
  }
39
 
40
+ combined_data = pd.concat([dataset_mapping[dataset_name] for dataset_name in datasets])
41
+
42
  fig, ax = plt.subplots(figsize=(8, 8))
43
+
44
+ centroids, labels = apply_kmeans(combined_data.values, k_value)
45
+ ax.scatter(combined_data['x'], combined_data['y'], c=labels, cmap='viridis')
46
+ ax.scatter(centroids[:, 0], centroids[:, 1], s=200, c='red', marker='X')
47
+
 
48
  ax.set_xlim(0, 100)
49
  ax.set_ylim(0, 100)
50
  ax.set_title(f"K-means clustering result (k={k_value})")
 
51
  st.pyplot(fig)
52
 
53
  if __name__ == "__main__":