Matplotlib散点图的不同颜色图例

时间:2020-02-03 07:00:03

标签: python matplotlib scatter-plot

fig, ax = plt.subplots()
sc = ax.scatter(leaf_data["eccentricity"], leaf_data["smoothness"], c = leaf_data['class'])
ax.legend(leaf_data["class"])

由于某些原因,尽管在“类”列中有4个不同的值,但图例只有一个。

0 个答案:

没有答案