参考网址:
http://stackoverflow.com/questions/22408237/named-colors-in-matplotlib
http://stackoverflow.com/questions/8409095/matplotlib-set-markers-for-individual-points-on-a-line
- 常用颜色:
八种内建默认颜色缩写
b: blue
g: green
r: red
c: cyan
m: magenta
y: yellow
k: black
w: white
其他颜色表示方法:灰色阴影,html 十六进制RGB 元组
- 简单例子:绘制 曲线
import matplotlib.pyplot as plt
plt.subplots(1, 1)
x= range(100)
y= [i**2 for i in x]
plt.plot(x, y, linewidth = '1', label = "test", color='y', linestyle=':', marker='|')
plt.legend(loc='upper left')
plt.show()
结果:
3. 第二个参考网址给出的linestyle可选参数:
'-' solid line style
'--' dashed line style
'-.' dash-dot line style
':' dotted line style
4.第二个参考网址给出的marker可选参数:
'.' 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
4.