更改子图中的绘图大小
我创建了一个包含 4 个子图 (2 x 2) 的图形,其中 3 个为 imshow
类型,另一个为 errorbar
类型。每个 imshow
图的右侧还有一个颜色条。我想调整我的第三个图的大小,该图的面积将恰好位于其上方的图的下方(没有颜色条)
示例(这就是我现在拥有的):
作为 sstatic.net/4cWBD.png" alt="example">
我如何调整第三个图的大小?
问候
i create a figure with 4 subplots (2 x 2), where 3 of them are of the type imshow
and the other is errorbar
. Each imshow
plots have in addition a colorbar at the right side of them. I would like to resize my 3rd plot, that the area of the graph would be exactly under the one above it (with out colorbar)
as example (this is what i now have):
How could i resize the 3rd plot?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要调整坐标区实例的尺寸,您需要使用 set_position() 方法。这也适用于 subplotAxes。要获取轴的当前位置/尺寸,请使用 get_position() 方法,返回一个 Bbox 实例。对我来说,从概念上讲,与位置(即[左、下、右、上]限制)交互更容易。要从 Bbox 访问此信息,请使用 bounds 属性。
在这里,我将这些方法应用于与上面的示例类似的内容:
您可能会觉得这两个图看起来并不完全相同(在我的渲染中,左侧或 xmin 位置不太正确),因此请随意调整位置,直到你得到了想要的效果。
To adjust the dimensions of an axes instance, you need to use the set_position() method. This applies to subplotAxes as well. To get the current position/dimensions of the axis, use the get_position() method, which returns a Bbox instance. For me, it's conceptually easier to just interact with the position, ie [left,bottom,right,top] limits. To access this information from a Bbox, the bounds property.
Here I apply these methods to something similar to your example above:
You may feel that the two plots do not exactly look the same (in my rendering, the left or xmin position is not quite right), so feel free to adjust the position until you get the desired effect.