matplotlib的plot()函数、颜色字符、符号字符详解

matplotlib的plot()函数

plot(x,y,颜色字符和标记字符)

1.例子

 plt.plot(X,y,'bs')
 plt.plot(X,y,'gv')

展示结果如图:

matplotlib的plot()函数、颜色字符、符号字符详解_第1张图片

第一行的 bs:b指blue(蓝色) s指square marker(方块符号)
第二行的 gv: g指green绿色 v指下三角符号
颜色和符号标记见下表

2.颜色字符

character color
'b' blue
'g' green
'r' red
'c' cyan
'm' magenta
'y' yellow
'k' black
'w' white

3.符号字符

character description
'.' 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
'8' octagon marker
's' square marker
'p' pentagon marker
'P' plus (filled) marker
'*' star marker
'h' hexagon1 marker
'H' hexagon2 marker
'+' plus marker
'x' x marker
'X' x (filled) marker
'D' diamond marker
'd' thin_diamond marker
`’ '`
'_' hline marker

4.线性字符

character description
'-' solid line style
'--' dashed line style
'-.' dash-dot line style
':' dotted line style

你可能感兴趣的:(python)