# Quick Question - about trying to add a color pointer to an x,y scale

Hello everybody! i know this might seem like something that doesn’t get asked too much or maybe never gets asked, but i became curious since i saw the graph displayed in the course of python, and since i just started doing the course might as well ask, this code is predetermined by the course but i want to add something specific to it, for example it gives a graph displaying x,y using the unsupervised learning, so it shows the display using dots, what i want to add is the identifier of those dots, for example the dots are scattered, can i add a color pointer to the label that explains which dot represents what label? this is the code for that example btw.

Sorry i know this might seem botherish since i just started the course and haven’t figured too much about it, but it just kinda clicked into me that i needed to do that since it might seem like something that i might want to do later and might as well know it from the start or at least try to understand a bit of how it works.

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans

mu = 1
std = 0.5
mu2 = 4.188

np.random.seed(100)

xs = np.append(np.append(np.append(np.random.normal(0.25,std,100), np.random.normal(0.75,std,100)), np.random.normal(0.25,std,100)), np.random.normal(0.75,std,100))

ys = np.append(np.append(np.append(np.random.normal(0.25,std,100), np.random.normal(0.25,std,100)), np.random.normal(0.75,std,100)), np.random.normal(0.75,std,100))

values = list(zip(xs, ys))

model = KMeans(init=‘random’, n_clusters=2)

results = model.fit_predict(values)

plt.scatter(xs, ys, c=results, alpha=0.6)

colors = [’#6400e4’, ‘#ffc740’]

for i in range(2):
points = np.array([values[j] for j in range(len(values)) if results[j] == i])
plt.scatter(points[:, 0], points[:, 1], c=colors[i], alpha=0.6)

plt.title(‘Codecademy Mobile Feedback - Data Science’)

plt.xlabel(‘Learn Python’, ‘#6400e4’ + c=colors) – this is me trying to add that color to the label
plt.ylabel(‘Learn SQL’,’#ffc740’ + c=colors) – same as above

plt.show()