创建多个子图

# -*- coding: gb2312 -*-
import matplotlib.pyplot as plt
fig=plt.figure()
ax=fig.add_subplot(2,2,1)
ax=fig.add_subplot(2,2,2)
ax=fig.add_subplot(2,2,3)
ax=fig.add_axes([0.2,0.4,0.2,0.4])
for i in fig.axes:  #依次获取每一个子图
    i.plot([1,2],[2,3])
t=fig.gca()#获取当前子图
t.scatter([5,2],[6,2],c='r')
plt.show()

@`6PKF8C%7XT~9NN{{N]()J

posted @ 2014-04-26 22:11  sxcww  阅读(280)  评论(0编辑  收藏  举报