概述
![在这里插入图片描述](https://img-blog.csdnimg.cn/c620f453063e4d65b3fdec65f47d2a37.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
primitives 和 container的关系
![在这里插入图片描述](https://img-blog.csdnimg.cn/c7c9c555ec044a9daea5952e6cc0d1ad.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
matplotlib标准使用流程
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1)
t = np.arange(0.0, 1.0, 0.01)
s = np.sin(2*np.pi*t)
line = ax.plot(t, s, color='darkgreen', lw=5)
![在这里插入图片描述](https://img-blog.csdnimg.cn/bcc8d1444e49471f92cd37e1fd902872.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
基本元素 primitives
Line2D
![在这里插入图片描述](https://img-blog.csdnimg.cn/68ed6b1138f94a928994cf69e437db2d.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
设置Line2D的属性
![在这里插入图片描述](https://img-blog.csdnimg.cn/2eaef33e953a481b974d4e3a8554e2b6.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
plt.plot(x,y, linewidth=10, color='b');
![在这里插入图片描述](https://img-blog.csdnimg.cn/5703de8a5dd64565ab5ad47899376adf.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
line, = plt.plot(x, y, '*')
line.set_antialiased(False)
![在这里插入图片描述](https://img-blog.csdnimg.cn/52a5f10c6fed4f97aa39e735de16e073.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
lines = plt.plot(x, y)
plt.setp(lines, color='g', linewidth=7);
![在这里插入图片描述](https://img-blog.csdnimg.cn/7ae61453282644f0ab32ba3848f357d9.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
如何绘制Lines
![在这里插入图片描述](https://img-blog.csdnimg.cn/3e5d3b2e94e04d1a865438d0c27c8965.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
绘制直线line
方法一:用pyplot
plt.plot(x,y);
方法二:Line2D对象绘制
from matplotlib.lines import Line2D
fig = plt.figure()
ax = fig.add_subplot(111)
line = Line2D(x, y)
ax.add_line(line)
ax.set_xlim(min(x), max(x))
ax.set_ylim(min(y), max(y))
plt.show()
errorbar绘制误差折线图
plt.errorbar(x, y+3, yerr=yerr,
label='both limits (default)',
fmt='co--');
![在这里插入图片描述](https://img-blog.csdnimg.cn/8bff2e5e8144428cbfc8615c2ecdc725.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)
![在这里插入图片描述](https://img-blog.csdnimg.cn/b647acafddd347fab58986ffe5ffd875.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBASl9jYWljYWljYWk=,size_20,color_FFFFFF,t_70,g_se,x_16)