I'm trying to plot tSNE 2d results,
plt.scatter(x=S_embedded[:,0], y=S_embedded[:,1], c=labels_sample, cmap='tab20')
handles = []
for i, name in clusters_dict.items():
handles.append(mpatches.Patch(**color=???**, label=name))
plt.legend(handles=handles, bbox_to_anchor=(1.5,0.5), loc="right")
plt.show()
labels_sample is an array that contains the labels of the points, S_embedded is the 2d tSNE projection results. clusters_dict is a dictionary, the keys are the possible values in labels_sample, and the valued are the name for each label ({0: 'a', 1:'c',...}).
My question:
- how can I specify the right color when adding the patches (to be consistent with the colors in the scatter plot)?