Matplotlib savefig到PDF的不同页面 [英] Matplotlib savefig into different pages of a PDF

查看:136
本文介绍了Matplotlib savefig到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.

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆