import numpy as np
import matplotlib.pyplot as plt
c1_x = np.array([1.2, 1.8, 2.5, 2.0, 1.5])
c1_y = np.array([2.1, 3.4, 2.2, 1.8, 2.9])
c2_x = np.array([8.1, 9.2, 8.8, 9.5, 8.4])
c2_y = np.array([8.0, 9.2, 7.8, 8.5, 9.0])
center1 = [np.mean(c1_x), np.mean(c1_y)]
center2 = [np.mean(c2_x), np.mean(c2_y)]
print("Cluster 1 Centroid (Magnet 1): (%.2f, %.2f)" % (center1[0], center1[1]))
print("Cluster 2 Centroid (Magnet 2): (%.2f, %.2f)" % (center2[0], center2[1]))
plt.scatter(c1_x, c1_y, label="Cluster 1 Points")
plt.scatter(c2_x, c2_y, label="Cluster 2 Points")
plt.scatter([center1[0], center2[0]], [center1[1], center2[1]], label="K-Means Centroids")
plt.xlabel("Feature 1 (X)")
plt.ylabel("Feature 2 (Y)")
plt.title("K-Means 2D Clustering & Centroid Magnets")