创建多个子图
# -*- 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 @`6PKF8C%7XT~9NN{{N]()J](http://images0.cnblogs.com/blog/550306/201404/262210550299558.jpg)
浙公网安备 33010602011771号