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 and context.

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 to Proj.

  • 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. Use grid to toggle both.

  • longridminor, latgridminor (bool, optional) – Whether to draw “minor” longitude and latitude lines. Default is rc.gridminor = False. Use gridminor to toggle both.

  • lonlocator, latlocator (str, float, list of float, or Locator, optional) – Used to determine the longitude and latitude gridline locations. Passed to the Locator constructor. Can be string, float, list of float, or matplotlib.ticker.Locator instance.

    For basemap or cartopy < 0.18, the defaults are 'deglon' and 'deglat', which correspond to the LongitudeLocator and LatitudeLocator locators (adapted from cartopy). For cartopy >= 0.18, the defaults are 'dmslon' and 'dmslat', which uses the same locators with dms=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 and latlocator but for the “minor” gridlines. The defaults are rc[‘grid.lonminorstep’] and rc[‘grid.latminorstep’].

  • lonminorlocator_kw, latminorlocator_kw, lonminorlines_kw, latminorlines_kw (optional) – As with lonlocator_kw and latlocator_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 and latlabels to True. Default is rc[‘grid.labels’] = False.

  • lonlabels, latlabels – Whether to label longitudes and latitudes, and on which sides of the map. There are four different options:

    1. Boolean True. Indicates the left side for latitudes, bottom side for longitudes.

    2. A string indicating the side names, e.g. 'lr' for latitudes or 'bt' for longitudes.

    3. A boolean 2-tuple indicating whether to draw labels on the (left, right) sides for latitudes, or (bottom, top) sides for longitudes.

    4. A boolean 4-tuple indicating whether to draw labels on the (left, right, bottom, top) sides, as with the basemap drawmeridians and drawparallels labels keyword.

  • lonformatter, latformatter (str or Formatter, optional) – Formatter spec used to style longitude and latitude gridline labels. Passed to the Formatter constructor. Can be string, list of string, or matplotlib.ticker.Formatter instance.

    For basemap or cartopy < 0.18, the defaults are 'deglon' and 'deglat', which correspond to SimpleFormatter presets with degree symbols and cardinal direction suffixes. For cartopy >= 0.18, the defaults are 'dmslon' and 'dmslat', which uses cartopy’s LongitudeFormatter and LatitudeFormatter formatters with dms=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 and rc[‘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 specifying ax.format(lonlocator='deglon', latlocator='deglon') and ax.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, and rc.innerborders settings passed to context. The style can be modified using additional rc settings.

    For example, to change rc[‘land.color’], use ax.format(landcolor='green'), and to change rc[‘land.zorder’], use ax.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 using context.

  • **kwargs – Passed to Axes.format or passed to context and used to update axes rc settings. For example, abcstyle='A.' modifies the rc[‘abc.style’] setting.