如何限制 Cartopy 的 LambertConformal 中的经度范围并保持圆锥外观?

How do I limit the longitude extent in Cartopy's LambertConformal and keep the conic looks?

我想制作一个以欧洲为中心的兰伯特圆锥曲线图。我可以做到以下几点:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

proj = ccrs.LambertConformal(central_longitude=20.0, central_latitude=45.0, cutoff=30)
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111, projection=proj)
ax.coastlines(resolution='110m')
plt.show()

然而,这向东和向西延伸得太多了。我想将其缩小到 10W 到 40E 之间。如果我添加一条线 ax.set_extent([-10,40,30,90], crs=ccrs.PlateCarree()),我将失去上面情节的圆锥形“外观”:

如何正确减小 Cartopy 的 LambertConformal 中的纵向范围,并仍然保持圆锥外观?我可以给出经度边距并在两条经线之间调整第一个数字,而不是将它放在这个矩形中吗?我想象两条经线之间的三角形,以及纬度下限的拱形。

这是您要找的吗?

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import matplotlib.path as mpath

ax = plt.axes(projection=ccrs.LambertConformal(central_longitude=20.0, central_latitude=45.0))
ax.gridlines()
ax.coastlines(resolution='110m')

# Lon and Lat Boundaries
xlim = [-10, 40]
ylim = [30, 90]
lower_space = 10 # this needs to be manually increased if the lower arched is cut off by changing lon and lat lims

rect = mpath.Path([[xlim[0], ylim[0]],
                   [xlim[1], ylim[0]],
                   [xlim[1], ylim[1]],
                   [xlim[0], ylim[1]],
                   [xlim[0], ylim[0]],
                   ]).interpolated(20)

proj_to_data = ccrs.PlateCarree()._as_mpl_transform(ax) - ax.transData
rect_in_target = proj_to_data.transform_path(rect)

ax.set_boundary(rect_in_target)
ax.set_extent([xlim[0], xlim[1], ylim[0] - lower_space, ylim[1]])

改编自this example

输出: