散点图,如何加legend
plt.plot(x, y1, "-b", label="sine")
plt.plot(x, y2, "-r", label="cosine")
plt.legend(loc="upper left")
基本思想是分开画,
最后把legend给加上去
plt.scatter(x = tsne_results2[a:b,0], y = tsne_results2[a:b,1], c = "grey", alpha = 0.25, label="Neutral") plt.scatter(x = tsne_results2[c:d,0], y = tsne_results2[c:d,1], c = "tomato", alpha = 0.25, label="Drop09NaCl") plt.scatter(x = tsne_results2[e:f,0], y = tsne_results2[e:f,1], c = "violet", alpha = 0.25, label="Drop30NaCl") plt.legend(loc = "best") plt.title("PCA")