cartopy五个常用模块
cartopy五个常用模块
1、GeoAxes.set_extent() 对图形范围(经纬度)进行设置的函数
set_extent(self, extents, crs=None) Set the extent (x0, x1, y0, y1) of the map in the given coordinate system. If no crs is given, the extents' coordinate system will be assumed to be the Geodetic version of this axes' projection. Parameters ---------- extent Tuple of floats representing the required extent (x0, x1, y0, y1). |
2、GeoAxes.add_feature() 添加地理特征要素
add_feature(self, feature, **kwargs) Add the given :class:`~cartopy.feature.Feature` instance to the axes. Parameters ---------- feature An instance of :class:`~cartopy.feature.Feature`. Returns ------- A :class:`cartopy.mpl.feature_artist.FeatureArtist` instance The instance responsible for drawing the feature. Note ---- Matplotlib keyword arguments can be used when drawing the feature. This allows standard Matplotlib control over aspects such as 'facecolor', 'alpha', etc. |
import cartopy.feature as cfeature
feature参数,函数cartoopy.feature.
DATA BORDERS = <cartopy.feature.NaturalEarthFeature object> COASTLINE = <cartopy.feature.NaturalEarthFeature object> COLORS = {'land': array([0.9375 , 0.9375 , 0.859375]), 'land_alt1': ... LAKES = <cartopy.feature.NaturalEarthFeature object> LAND = <cartopy.feature.NaturalEarthFeature object> 陆地 OCEAN = <cartopy.feature.NaturalEarthFeature object> 海洋 RIVERS = <cartopy.feature.NaturalEarthFeature object> STATES = <cartopy.feature.NaturalEarthFeature object> absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0... division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192... print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0)...
**kwargs通用参数
with_scale() alpha = 透明度3、GeoAxes.add_geometries()
add_geometries(self, geoms, crs, **kwargs) Add the given shapely geometries (in the given crs) to the axes. Parameters ---------- geoms A collection of shapely geometries. crs The cartopy CRS in which the provided geometries are defined. styler A callable that returns matplotlib patch styling given a geometry. Returns ------- A :class:`cartopy.mpl.feature_artist.FeatureArtist` instance The instance responsible for drawing the feature. Note ---- Matplotlib keyword arguments can be used when drawing the feature. This allows standard Matplotlib control over aspects such as 'facecolor', 'alpha', etc. |
4、GeoAxes.gridlines() 是否在画图时打开网格线
class cartopy.mpl.gridliner.Gridliner(axes, crs, draw_labels=False, xlocator=None, ylocator=None, |
例 ax.gridlines(draw_labels=Flase) 如果设置为True,标签会很混乱,用下面讲的函数来设置标签
5、cticker.LongitudeFormatter() 设置经纬度坐标刻度
import cartopy.mpl.ticker as cticker
class cartopy.mpl.gridliner.Gridliner(axes, crs, draw_labels=False, xlocator=None, ylocator=None, collection_kwargs=None, xformatter=None, yformatter=None, dms=False, x_inline=None, y_inline=None, auto_inline=True, xlim=None, ylim=None, rotate_labels=None, xlabel_style=None, ylabel_style=None, labels_bbox_style=None, xpadding=5, ypadding=5, offset_angle=25, auto_update=False, formatter_kwargs=None)[source]
- property bottom_label_artists
-
The bottom labels which were created at draw time
- bottom_labels
-
Whether to draw labels on the bottom of the map.
- collection_kwargs
-
A dictionary passed through to
matplotlib.collections.LineCollection
on grid line creation.
- property geo_label_artists
-
The geo spine labels which were created at draw time
- geo_labels
-
Whether to draw labels near the geographic limits of the map.
- property label_artists
-
All the labels which were created at draw time
- labels_bbox_style
-
bbox style for grid labels
- property left_label_artists
-
The left labels which were created at draw time
- left_labels
-
Whether to draw labels on the left hand side of the map.
- n_steps
-
The number of interpolation points which are used to draw the gridlines.
- property right_label_artists
-
The right labels which were created at draw time
- right_labels
-
Whether to draw labels on the right hand side of the map.
- property top_label_artists
-
The top labels which were created at draw time
- top_labels
-
Whether to draw labels on the top of the map.
- x_inline
-
Whether to draw x labels inline
- property x_inline_label_artists
-
The x-coordinate inline labels which were created at draw time
- xformatter
-
The
Formatter
to use for the lon labels.
- property xlabel_artists
-
The x-coordinate labels which were created at draw time
- xlabel_style
-
A dictionary passed through to
ax.text
on x label creation for styling of the text labels.
- xline_artists
-
The x gridlines which were created at draw time.
- xlines
-
Whether to draw the x gridlines.
- xpadding
-
The padding from the map edge to the x labels in points.
- y_inline
-
Whether to draw y labels inline
- property y_inline_label_artists
-
The y-coordinate inline labels which were created at draw time
- yformatter
-
The
Formatter
to use for the lat labels.
- property ylabel_artists¶
-
The y-coordinate labels which were created at draw time
- ylabel_style
-
A dictionary passed through to
ax.text
on y label creation for styling of the text labels.
- yline_artists
-
The y gridlines which were created at draw time.
- ylines
-
Whether to draw the y gridlines.
- ypadding
-
The padding from the map edge to the y labels in points.