i have two methods one for drawing the centers for the cluster
def draw_roh_delta(self, rho, delta, center, plot):
plot.scatter(rho, delta, label='rho-delta', c='k', s=5)
plot.set_xlabel('rho')
plot.set_ylabel('delta')
center_rho = rho[center]
center_delta = delta[center]
np.random.seed(6)
colors = np.random.rand(len(center), 3)
plot.scatter(center_rho, center_delta, c=colors)
plot.legend()
and others for drawing the cluster
def draw_cluster(self, title, cluster, halo, points, plot):
cluster_points = dict()
colors = dict()
np.random.seed(10)
for k, v in cluster.items():
cluster_points[k] = points.loc[cluster[k], :]
colors[k] = np.random.rand(3)
for k, v in cluster_points.items():
plot.scatter(v.loc[:, 'x'], v.loc[:, 'y'], c=colors[k], alpha=0.5)
plot.scatter(v.at[k, 'x'], v.at[k, 'y'], c=colors[k], s=np.pi * 10 ** 2)
I need to make the color of the centers the same color as the clusters instead of creating them randomly. can someone help, please?
EDIT
def draw_roh_delta(self, rho, delta, center, plot):
plot.scatter(rho, delta, label='rho-delta', c='k', s=5)
plot.set_xlabel('rho')
plot.set_ylabel('delta')
center_rho = rho[center]
center_delta = delta[center]
color= ['red', 'blue', 'green', 'yellow','orange','purple']
plot.scatter(center_rho, center_delta, c=color)
plot.legend()