制图功能界面#

data copyright, license and attribution 可以使用在地图上混合 text annotations (mpl docs) 所示 feature_creation .

已经为常见功能定义了特定的特征子类,例如访问自然地球或GSHHS形状文件。这些列表可以在 the reference documentation .

为了简化一些非常常见的情况,一些预定义的功能存在为 cartopy.feature constants.预定义的特征都是小规模的(1:110 m) Natural Earth 数据集,并且可以通过以下方法添加 GeoAxes.add_feature :

名称

描述

BORDERS#

国家边界。

COASTLINE#

海岸线,包括主要岛屿。

LAKES#

天然和人工湖泊。

LAND#

陆地多边形,包括主要岛屿。

OCEAN#

海洋多边形。

RIVERS#

三线排水系统,包括湖泊中心线。

STATES#

内部的一级行政边界(仅限于此规模的美国)。Natural Earth对于大多数国家/地区来说都有一级行政边界,比例为1:10,000,000;可以通过以下方式访问这些边界 cartopy.feature.STATES.with_scale('10m')

备注

任何自然地球数据集都可以通过创建 cartopy.feature.NaturalEarthFeature .例如::

import cartopy.feature as cfeature
land_50m = cfeature.NaturalEarthFeature('physical', 'land', '50m',
                                        edgecolor='face',
                                        facecolor=cfeature.COLORS['land'])

中还存在一些用于绘制要素的有用颜色的字典 cartopy.feature.COLORS .

有关本词典中的完整姓名列表:

>>> import cartopy.feature
>>> sorted(cartopy.feature.COLORS.keys())
['land', 'land_alt1', 'water']

在Matplotlib接口中使用Element类的示例#

../_images/sphx_glr_feature_creation_001.png