更改 CCRS 后形状消失

Shape disappears after changing the CCRS

接下来,我在地球圈绘制非洲大陆的国家:

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

import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
africa = world[(world['continent'] == 'Africa')]

latlon_proj = ccrs.PlateCarree()
axis_proj = ccrs.Mollweide()

ax = plt.axes(projection=axis_proj)
ax.stock_img()

for ea in africa['geometry']:
    
    feat = cartopy.feature.ShapelyFeature(
        [ea],
        latlon_proj,
        facecolor="lime",
        edgecolor='black',
        lw=0.2
        )
    
    ax.add_feature(feat)

plt.show()

然而,当我将 latlon_projaxis_proj 更改为 ccrs.Orthographic() 时,非洲大陆消失了:

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

import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
africa = world[(world['continent'] == 'Africa')]

latlon_proj = ccrs.Orthographic()
axis_proj = ccrs.Orthographic()

ax = plt.axes(projection=axis_proj)
ax.stock_img()

for ea in africa['geometry']:
    
    feat = cartopy.feature.ShapelyFeature(
        [ea],
        latlon_proj,
        facecolor="lime",
        edgecolor='black',
        lw=0.2
        )
    
    ax.add_feature(feat)

plt.show()

如何在更改CCRS时保留非洲大陆?

代码中对 CRS 的使用有误。这是它的正确版本。

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

import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
africa = world[(world['continent'] == 'Africa')]

latlon_proj = ccrs.PlateCarree()  ## The correct CRS
axis_proj = ccrs.Orthographic()

ax = plt.axes(projection=axis_proj)
ax.stock_img()

for ea in africa['geometry']:

    feat = cartopy.feature.ShapelyFeature(
        [ea],
        latlon_proj,
        facecolor="lime",
        edgecolor='black',
        lw=0.2
        )

    ax.add_feature(feat)

plt.show()