4.matplotlib绘制各种类型散点图标
通常绘制的散点图是圆形的点,有时候需要区分各种散点可以添加各种颜色,但是为了更加美观,可以选择添加各种类型的图标:
具体操作时,就是需要添加一个markers图标标记,如'o'表示圆形
markers= ['o', '^', '+']
for i in range(3):
ax.scatter(data[0], data[1], c='black', marker=markers[i])
参考图标:
'.' point marker
',' pixel marker
'o' circle marker
'v' triangle_down marker
'^' triangle_up marker
'<' triangle_left marker
'>' triangle_right marker
'1' tri_down marker
'2' tri_up marker
'3' tri_left marker
'4' tri_right marker
's' square marker
'p' pentagon marker
'*' star marker
'h' hexagon1 marker
'H' hexagon2 marker
'+' plus marker
'x' x marker
'D' diamond marker
'd' thin_diamond marker
'|' vline marker
'_' hline marker
参考