python matplotlib库学习笔记(备忘)

画子图,对子图的相关设置

import matplotlib.pyplot as plt

plt.figure()

ax1 = plt.subplot(211) # 2行1列第1个子图
ax1.set_xlabel('x1')
plt.plot(x_data1, y_data1)

ax2 = plt.subplot(212) # 2行1列第2个子图
ax2.set_xlabel('x2')
plt.plot(x_data2, y_data2)

plt.show()

学习:https://www.cnblogs.com/wei-li/archive/2012/05/23/2506940.html

posted @ 2018-10-07 16:23  MrZJ  阅读(160)  评论(0编辑  收藏  举报