GeoAxes.format¶
- GeoAxes.format(*, lonlim=None, latlim=None, boundinglat=None, longrid=None, latgrid=None, longridminor=None, latgridminor=None, lonlocator=None, lonlines=None, latlocator=None, latlines=None, latmax=None, lonminorlocator=None, lonminorlines=None, latminorlocator=None, latminorlines=None, lonlocator_kw=None, lonlines_kw=None, latlocator_kw=None, latlines_kw=None, lonminorlocator_kw=None, lonminorlines_kw=None, latminorlocator_kw=None, latminorlines_kw=None, lonformatter=None, latformatter=None, lonformatter_kw=None, latformatter_kw=None, labels=None, latlabels=None, lonlabels=None, loninline=None, latinline=None, rotatelabels=None, labelpad=None, dms=None, nsteps=None, patch_kw=None, **kwargs)[source]¶
Modify the longitude and latitude labels, longitude and latitude map limits, geographic features, and more. Unknown keyword arguments are passed to
Axes.format
andcontext
.- Parameters
lonlim, latlim ((float, float), optional) – For cartopy axes only. The approximate longitude and latitude boundaries of the map, applied with
set_extent
. Basemap axes extents must be declared by passing keyword arguments toProj
.boundinglat (float, optional) – For cartopy axes only. The edge latitude for the circle bounding North Pole and South Pole-centered projections. Basemap bounding latitudes must be declared by passing keyword arguments to
Proj
.longrid, latgrid (bool, optional) – Whether to draw longitude and latitude gridlines. Default is
rc.grid
=True
. Usegrid
to toggle both.longridminor, latgridminor (bool, optional) – Whether to draw “minor” longitude and latitude lines. Default is
rc.gridminor
=False
. Usegridminor
to toggle both.lonlocator, latlocator (str, float, list of float, or
Locator
, optional) – Used to determine the longitude and latitude gridline locations. Passed to theLocator
constructor. Can be string, float, list of float, ormatplotlib.ticker.Locator
instance.For basemap or cartopy < 0.18, the defaults are
'deglon'
and'deglat'
, which correspond to theLongitudeLocator
andLatitudeLocator
locators (adapted from cartopy). For cartopy >= 0.18, the defaults are'dmslon'
and'dmslat'
, which uses the same locators withdms=True
. This selects gridlines at nice degree-minute-second intervals when the map extent is very small.lonlines, latlines (optional) – Aliases for
lonlocator
,latlocator
.lonlocator_kw, latlocator_kw (dict, optional) – Keyword argument dictionaries passed to the
matplotlib.ticker.Locator
class.lonlines_kw, latlines_kw (optional) – Aliases for
lonlocator_kw
,latlocator_kw
.lonminorlocator, latminorlocator, lonminorlines, latminorlines (optional) – As with
lonlocator
andlatlocator
but for the “minor” gridlines. The defaults arerc[‘grid.lonminorstep’]
andrc[‘grid.latminorstep’]
.lonminorlocator_kw, latminorlocator_kw, lonminorlines_kw, latminorlines_kw (optional) – As with
lonlocator_kw
andlatlocator_kw
but for the “minor” gridlines.latmax (float, optional) – The maximum absolute latitude for longitude and latitude gridlines. Longitude gridlines are cut off poleward of this latitude for all basemap projections and cartopy projections before cartopy 0.18. Default is
80
.labels (bool, optional) – Sets
lonlabels
andlatlabels
toTrue
. Default isrc[‘grid.labels’]
=False
.lonlabels, latlabels – Whether to label longitudes and latitudes, and on which sides of the map. There are four different options:
Boolean
True
. Indicates the left side for latitudes, bottom side for longitudes.A string indicating the side names, e.g.
'lr'
for latitudes or'bt'
for longitudes.A boolean 2-tuple indicating whether to draw labels on the
(left, right)
sides for latitudes, or(bottom, top)
sides for longitudes.A boolean 4-tuple indicating whether to draw labels on the
(left, right, bottom, top)
sides, as with the basemapdrawmeridians
anddrawparallels
labels
keyword.
lonformatter, latformatter (str or
Formatter
, optional) – Formatter spec used to style longitude and latitude gridline labels. Passed to theFormatter
constructor. Can be string, list of string, ormatplotlib.ticker.Formatter
instance.For basemap or cartopy < 0.18, the defaults are
'deglon'
and'deglat'
, which correspond toSimpleFormatter
presets with degree symbols and cardinal direction suffixes. For cartopy >= 0.18, the defaults are'dmslon'
and'dmslat'
, which uses cartopy’sLongitudeFormatter
andLatitudeFormatter
formatters withdms=True
. This formats gridlines that do not fall on whole degrees as “minutes” and “seconds” rather than decimal degrees.lonformatter_kw, latformatter_kw (optional) – Keyword argument dictionaries passed to the
matplotlib.ticker.Formatter
class.loninline, latinline (bool, optional) – For cartopy axes only. Whether to draw inline longitude and latitude gridline labels. Defaults are
rc[‘grid.loninline’]
=False
andrc[‘grid.latinline’]
=False
.rotatelabels (bool, optional) – For cartopy axes only. Whether to rotate longitude and latitude gridline labels. Default is
rc[‘grid.rotatelabels’]
=False
.labelpad (float, optional) – For cartopy axes only. Controls the padding between the map boundary and longitude and latitude gridline labels. Default is
rc[‘grid.pad’]
=5
.dms (bool, optional) – For cartopy axes only. Specifies whether the default locators and formatters should use “minutes” and “seconds” for gridline labels on small scales rather than decimal degrees. Setting this to
False
is equivalent to specifyingax.format(lonlocator='deglon', latlocator='deglon')
andax.format(lonformatter='deglon', latformatter='deglat')
.nsteps (int, optional) – For cartopy axes only. The number of interpolation steps used to draw gridlines. Default is
rc[‘grid.nsteps’]
=250
.land, ocean, coast, rivers, lakes, borders, innerborders (bool, optional) – Toggles various geographic features. These are actually the
rc.land
,rc.ocean
,rc.coast
,rc.rivers
,rc.lakes
,rc.borders
, andrc.innerborders
settings passed tocontext
. The style can be modified using additionalrc
settings.For example, to change
rc[‘land.color’]
, useax.format(landcolor='green')
, and to changerc[‘land.zorder’]
, useax.format(landzorder=4)
.reso ({‘lo’, ‘med’, ‘hi’, ‘x-hi’, ‘xx-hi’}) – For cartopy axes only. Resolution of geographic features. For basemap axes, this must be passed to
Proj
.patch_kw (dict-like, optional) – Keyword arguments used to update the background patch. This can be used e.g. to apply background hatching with
patch_kw={'hatch': 'xxx'}
.
- Other Parameters
rc_kw (dict, optional) – Dictionary containing
rc
settings applied to this axes usingcontext
.**kwargs – Passed to
Axes.format
or passed tocontext
and used to update axesrc
settings. For example,abcstyle='A.'
modifies therc[‘abc.style’]
setting.