1

我正在尝试制作一个顶部有一个面板(colspan = 2)和下面两个图的图,它们之间的空间量是可控的。我希望地块的边界对齐。这是我开始的内容:

import cartopy
from matplotlib import pyplot
from matplotlib.gridspec import GridSpec

gs = GridSpec(2, 2, height_ratios=[2, 1], hspace=0, wspace=0)

ax0 = pyplot.subplot(gs[0, :], projection=cartopy.crs.LambertConformal())
ax0.add_feature(cartopy.feature.COASTLINE)
ax0.set_extent([-120, -75, 20, 52], cartopy.crs.Geodetic())

ax1 = pyplot.subplot(gs[1, 0], projection=cartopy.crs.LambertConformal())
ax1.add_feature(cartopy.feature.COASTLINE)
ax1.set_extent([-90, -75, 20, 30], cartopy.crs.Geodetic())

ax2 = pyplot.subplot(gs[1, 1], projection=cartopy.crs.LambertConformal())
ax2.add_feature(cartopy.feature.COASTLINE)
ax2.set_extent([-90, -75, 20, 30], cartopy.crs.Geodetic())

pyplot.show()

不良

第一个问题是wspace=0参数不取。第二个问题是(至少这是我对如何进行的猜测)计算高度比,使上部子图的宽度等于下部子图的组合宽度(加上任何 wspace)。

4

0 回答 0