GeoAxes.format

GeoAxes.format()[source]

Modify map limits, longitude and latitude gridlines, geographic features, and more.

Parameters
  • lonlim, latlim (2-tuple of 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.

  • lonlines, latlines (optional) – Aliases for lonlocator, latlocator.

  • lonlocator, latlocator (locator-spec, 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_kw, latlines_kw (optional) – Aliases for lonlocator_kw, latlocator_kw.

  • lonlocator_kw, latlocator_kw (dict-like, optional) – Keyword arguments passed to the matplotlib.ticker.Locator class.

  • 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'].

  • lonminorlines_kw, latminorlines_kw (optional) – Aliases for lonminorlocator_kw, latminorlocator_kw.

  • lonminorlocator_kw, latminorlocator_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 predating cartopy 0.18. Default is 80.

  • labels (bool, optional) – Sets lonlabels and latlabels to True. Default is rc['grid.labels'] = False.

  • lonlabels, latlabels (optional) – 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 or tuple of strings indicating the side names, e.g. 'left' for latitudes or 'bottom' for longitudes.

    3. A string indicating the side names with single characters, e.g. 'lr' for latitudes or 'bt' for longitudes.

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

    5. 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 (formatter-spec, optional) – Formatter 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 (dict-like, optional) – Keyword arguments passed to the matplotlib.ticker.Formatter class.

  • loninline, latinline, inlinelabels (bool, optional) – For cartopy axes only. Whether to draw inline longitude and latitude gridline labels. Default is rc['grid.inlinelabels'] = False.

  • rotatelabels (bool, optional) – For cartopy axes only. Whether to rotate longitude and latitude gridline labels. Default is rc['grid.rotatelabels'] = False.

  • labelpad (unit-spec, optional) – For cartopy axes only. The padding between the map boundary and longitude and latitude gridline labels. Default is rc['grid.labelpad'] = 4.0. If float, units are points. If string, interpreted by units.

  • 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'). Default is rc['grid.dmslabels'] = True.

  • 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'}, optional) – For cartopy axes only. The resolution of geographic features. For basemap axes, this must be passed to Proj.

  • color (color-spec, optional) – Color for the axes edge. Propagates to gridlabelcolor unless specified otherwise (similar to proplot.axes.CartesianAxes.format).

  • gridlabelcolor (color-spec, optional) – Color for the grid labels. Inherits from color by default.

Other Parameters
  • title (str, optional) – The axes title.

  • abc (bool or str, optional) – The “a-b-c” subplot label style. Must contain the character a or A, for example 'a.', or 'A'. If True then the default style of 'a' is used. The a or A is replaced with the alphabetic character matching the number. If number is greater than 26, the characters loop around to a, …, z, aa, …, zz, aaa, …, zzz, etc.

  • abcloc, titleloc (str, optional) – Strings indicating the location for the a-b-c label and main title. The following locations are valid (defaults are rc['abc.loc'] = 'left' and rc['title.loc'] = 'center'):

    Location

    Valid keys

    center above axes

    'center', 'c'

    left above axes

    'left', 'l'

    right above axes

    'right', 'r'

    lower center inside axes

    'lower center', 'lc'

    upper center inside axes

    'upper center', 'uc'

    upper right inside axes

    'upper right', 'ur'

    upper left inside axes

    'upper left', 'ul'

    lower left inside axes

    'lower left', 'll'

    lower right inside axes

    'lower right', 'lr'

  • abcborder, titleborder (bool, optional) – Whether to draw a white border around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes. Defaults are rc['abc.border'] = True and rc['title.border'] = True.

  • abcbbox, titlebbox (bool, optional) – Whether to draw a white bbox around titles and a-b-c labels positioned inside the axes. This can help them stand out on top of artists plotted inside the axes. Defaults are rc['abc.bbox'] = False and rc['title.bbox'] = False.

  • abc_kw, title_kw (dict-like, optional) – Additional settings used to update the a-b-c label and title with text.update().

  • titlepad (float, optional) – The padding for the inner and outer titles and a-b-c labels in arbitrary units (default is points). Default is rc['title.pad'] = 5.0.

  • titleabove (bool, optional) – Whether to try to put outer titles and a-b-c labels above panels, colorbars, or legends that are above the axes. Default is rc['title.above'] = True.

  • abctitlepad (float, optional) – The horizontal padding between the a-b-c label and title when they are in the same location. Default is rc['abc.titlepad'] = 4.0.

  • ltitle, ctitle, rtitle, ultitle, uctitle, urtitle, lltitle, lctitle, lrtitle (str, optional) – Shorthands for the below keywords.

  • lefttitle, centertitle, righttitle, upperlefttitle, uppercentertitle, upperrighttitle, lowerlefttitle, lowercentertitle, lowerrighttitle (str, optoinal) – Additional titles in specific positions. This works as an alternative to the ax.format(title='Title', titleloc=loc) workflow and permits adding more than one title-like label for a single axes.

  • a, alpha, fc, facecolor, ec, edgecolor, lw, linewidth, ls, linestyle (optional) – Additional settings applied to the background patch, and their shorthands. Defaults are rc['axes.alpha'], rc['axes.facecolor'], rc['axes.edgecolor'], rc['axes.linewidth'], and '-', respectively.

  • rowlabels, collabels, llabels, tlabels, rlabels, blabels – Aliases for leftlabels and toplabels, and for leftlabels, toplabels, rightlabels, and bottomlabels, respectively.

  • leftlabels, toplabels, rightlabels, bottomlabels (sequence of str, optional) – Labels for the subplots lying along the left, top, right, and bottom edges of the figure. The length of each list must match the number of subplots along the corresponding edge.

  • leftlabelpad, toplabelpad, rightlabelpad, bottomlabelpad (float, optional) – The padding between the labels and the axes content in arbitrary units (default is points). Defaults are rc['leftlabel.pad'], rc['toplabel.pad'], rc['rightlabel.pad'], and rc['bottomlabel.pad']

  • leftlabels_kw, toplabels_kw, rightlabels_kw, bottomlabels_kw (dict-like, optional) – Additional settings used to update the labels with text.update().

  • figtitle – Alias for suptitle.

  • suptitle (str, optional) – The figure “super” title, centered between the left edge of the lefmost column of subplots and the right edge of the rightmost column of subplots, and automatically offset above figure titles. This is an improvement on matplotlib’s “super” title, which just centers the text between figure edges.

  • suptitlepad (float, optional) – The padding between the super title and the axes content in arbitrary units (default is points). Default is rc['suptitle.pad'].

  • suptitle_kw (optional) – Additional settings used to update the super title with text.update().

  • includepanels (bool, optional) – Whether to include panels when aligning figure “super titles” along the top of the subplot grid and when aligning the spanx x axis labels and spany y axis labels along the sides of the subplot grid. Default is False.

  • mathtext_fallback (bool or str, optional) – Apply this rc['mathtext.fallback'] value when drawing the figure. If True or string, unavailable glyphs are replaced with a glyph from a fallback font (Computer Modern by default). Otherwise, they are replaced with the “¤” dummy character. For details see this mathtext tutorial.

  • rc_mode (int, optional) – The context mode passed to context.

  • rc_kw (dict-like, optional) – An alternative to passing extra keyword arguments. See below.

  • **kwargs – Passed to proplot.config.Configurator.context and used to update the axes-relevant rc settings. For example, abc='A.' modifies the rc.abc setting, titleloc='left' modifies the rc['title.loc'] setting, gridminor=True modifies the rc.gridminor setting, and gridbelow=True modifies the rc['grid.below'] setting. Many of the keyword arguments documented above are actually applied by updating the rc settings then retrieving the updated settings.