我想在Matplotlib中有两个子图(嵌入在GUI中):
在这两种情况下,这些都是相同的宽度.
GridSpec似乎不允许绝对尺寸,只允许相对尺寸.我不希望Subplot 1在窗口调整大小的情况下拉伸它的高度.
我怎样才能做到这一点?
小智 1
如果我理解你的问题那么这段代码可能会有所帮助。它使用轴而不是子图,这可以更绝对地控制图中图的位置。
import pylab as pl
# use pylab.Axes(figure, [left, bottom, width, height])
# where each value in the frame is between 0 and 1
#top
figure = pl.figure()
axes = pl.Axes(figure, [.4,.4,.25,.25])
figure.add_axes(axes)
pl.plot([1, 2, 3], [1, 2, 3])
#bottom
axes = pl.Axes(figure, [.4,.1,.25,.25])
figure.add_axes(axes)
pl.plot([1, 2, 3], [1, 2, 3])
pl.show()
Run Code Online (Sandbox Code Playgroud)
如果这不是您的意思,请发布一段代码或示例来澄清。
| 归档时间: |
|
| 查看次数: |
864 次 |
| 最近记录: |