简体   繁体   English

使用matplotlib创建图形

[英]Create a figure of figures with matplotlib

I would like to know if there is a way to combined several figures created with matplotlib in one unique figure. 我想知道是否有一种方法可以将用matplotlib创建的多个图形组合到一个唯一的图形中。

Most of the existing topics are related to multiple plots within one figure. 现有的大多数主题都与一个图形中的多个图有关。 But here, I have several functions which all create one elaborated figure (not just a plot, the figure itself is a multiple plot with texts, title, legends,...) 但是在这里,我有几个函数都可以创建一个详细的图形(不仅仅是一个图形,图形本身是一个包含文本,标题,图例等的多个图形)。

So instead of just doing the layout of those several figures using a software like Word, is there a way to directly combined all my figures in one unique figure under python ? 因此,除了使用Word之类的软件仅对这几个图形进行布局之外,还有没有办法将我的所有图形直接组合在python下的一个唯一图形中?

Thank you in advance ! 先感谢您 !

The concept of figure in matplotlib does not allow to have a figure inside a figure. matplotlib中的图形概念不允许在图形内部包含图形。 The figure is the canvas for other artists, like axes. 该图是其他艺术家(例如轴)的画布。 You may of course add as many axes to a figure as you like. 当然,您可以根据需要向图形添加任意数量的轴。 So for example instead of one figure with 4 axes and another figure with 6 axes, you can create a figure with 10 axes. 因此,例如,可以创建一个包含10个轴的图形,而不是一个包含4个轴的图形和另一个包含6个轴的图形。

A good choice may be to use the gridspec, as detailed on the respecive matplotlib page . 一个不错的选择是使用gridspec,如有关的matplotlib页面上所述。

After additional researches, it seems my problem has no easy solution within Matplotlib itself. 经过更多的研究,看来我的问题在Matplotlib本身中没有简单的解决方案。 Multiple figures layout needs external post-processing of plots. 多图布局需要对图进行外部后处理。

For those having the same problem, here is an interesting link : Publication-quality figures with matplotlib and svgutils 对于那些有相同问题的人,这里是一个有趣的链接: 带有matplotlib和svgutils的出版物质量数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM