I can't add legend to my scatterplot. The problem that color is encoded by variable y which takes two values 0 or 1. X comes from PCA method, I try to plot 2 principal components with different colors corresponding to different y. I get error mesage "No handles with labels found to put in legend."
Tried different tutorial, but still cofused.
fig = plt.figure(figsize=(10,5))
ax = fig.add_subplot(111)
plt.scatter(x_reduced[:,0], x_reduced[:,1],c=y, alpha=0.5)
plt.legend()
plt.show()