I am drawing this scatterplot in python, and I would like to have the dot drawn in a different (contrasting) colour for each label. Each label has multiple points.
Seems like it could be something to feed to annotate, but I am not quite sure how, as I haven't been able to find it:
for i, label in enumerate(labels):
x, y = low_dim_embs[i, :]
plt.scatter(x, y)
plt.annotate(label,
xy=(x, y),
xytext=(5, 2),
textcoords='offset points',
ha='right',
va='bottom')
I can replace the above command by:
plt.scatter(x, y, color=mycolors)
Which will give me manually specified colors, but for each of the entries (and there are many repetitions per entry). Is there any automatic way?
My dataset looks like this:
x,y,label
1,2,label1
1,3,label1
2,-1,label1
4,1,label2
5,1,label2
...
Each coordinate belonging to labelx should have the same colour (I would probably also need those in a legend).