首页 > 技术文章 > matplotlib ----- 多子图, subplots

qingyuanjushi 2016-11-24 02:39 原文

 

这一篇讲的比较详细. 

http://matplotlib.org/examples/pylab_examples/subplots_demo.html

 

官方文档给出的subplots用法, 

http://matplotlib.org/api/pyplot_api.html

其中设置子图大小,  参数参见下面代码

 
import matplotlib.pyplot as plt

tPlot, axes = plt.subplots(
        nrows=4, ncols=1, sharex=True, sharey=False, 
        gridspec_kw={'height_ratios':[2,2,1,1]}
        )

tPlot.suptitle('node', fontsize=20)

axes[0].plot(range(10),'ro-') 
axes[1].plot(range(10),'bo-') 
axes[2].plot(range(10),'go-') 
axes[3].plot(range(10),'mo-') 

plt.show()

 

推荐阅读