Matplotlib savefig 到 PDF 的不同页面

编程入门 行业动态 更新时间:2024-10-28 19:21:12
本文介绍了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 faq 中有一些说明可以将绘图保存在 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/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file示例 http://matplotlib/examples/pylab_examples/multipage_pdf.html

这篇关于Matplotlib savefig 到 PDF 的不同页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-26 23:56:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/670240.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   Matplotlib   savefig   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!