Matplotlib savefig到PDF的不同页面 [英] Matplotlib savefig into different pages of a PDF
问题描述
我有一个冗长的图,由几个水平的子图组成,它们被组织成一列.
I have a lengthy plot, composed o several horizontal subplots organized into a column.
当我调用fig.savefig('what.pdf')时,生成的输出文件将所有图都塞满了一页.
When I call fig.savefig('what.pdf'), the resulting output file shows all the plots crammed onto a single page.
问题:是否有办法告诉savefig保存在任意数量(可能是自动确定的)pdf页面中?
Question: is there a way to tell savefig to save on any number (possibly automatically determined) of pdf pages?
如果可能,我宁愿避免使用多个文件,然后选择os.system('merge ...').
I'd rather avoid multiple files and then os.system('merge ...'), if possible.
推荐答案
我还没有尝试过,但是在matplolib常见问题解答中有一些说明,可以在多页中将图以pdf格式保存.
I haven't tried myself, but in the matplolib faq there are some instruction to save plots in pdf in several pages.
- 常见问题解答 http://matplotlib.org/faq/howto_faq. html#save-multiple-plots-to-一个pdf文件
- 示例 http://matplotlib.org/examples/pylab_examples/multipage_pdf.html
- FAQ http://matplotlib.org/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file
- Example http://matplotlib.org/examples/pylab_examples/multipage_pdf.html
这篇关于Matplotlib savefig到PDF的不同页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!