更改散点图的形状

时间:2019-04-15 09:55:26

标签: python scatter-plot markers

我想自定义散点-对于第一-星,第二-圆,第三-'+'。为此,我使用以下代码:

 fig = plt.figure(figsize = (8,8))
 ax = fig.add_subplot(1,1,1) 
 targets = [0, 1, 2]
 colors = ['brown', 'y', 'dimgrey']
 marker = ['*', 'o', '+']

 for target, color, shape in zip(targets, colors, marker):
    indicesToKeep = finalDf['target'] == target
    ax.scatter(finalDf.loc[indicesToKeep, 'principal component 1']
           , finalDf.loc[indicesToKeep, 'principal component 2']
           , c = color
           , s = 50)
 ax.grid()

但是它只给出圆圈。你能帮我发现一个错误吗?

0 个答案:

没有答案