xoa.plot.add_fancy_map_frame

xoa.plot.add_fancy_map_frame#

xoa.plot.add_fancy_map_frame(ax, width=None, sides=('bottom', 'left', 'top', 'right'), colors=None, xticks=None, yticks=None, inside=False, linewidth=None, edgecolor=None, zorder=None)[source]#

Add a black and white alternating frame to a map, like GMT does

The frame is cut at the longitudes and latitudes of the gridlines, which are created without lines nor labels if the axes has none. Their locators are the cartopy longitude and latitude ones, for all projections. It requires a projection whose meridians and parallels are parallel to the edges of the map, like PlateCarree or Mercator. Existing tick labels are moved away by the width of the frame. The default values of the parameters that are None come from the plot.fancy_<name> options.

Parameters:
  • ax (cartopy.mpl.geoaxes.GeoAxes)

  • width (None, float) – Width of the frame in points

  • sides (list(str)) – Sides to decorate among “bottom”, “left”, “top” and “right”

  • colors (None, tuple) – Colors of the first and second alternating segments

  • xticks (None, array_like, matplotlib.ticker.Locator) – Longitudes and latitudes where the frame is cut. They default to the locators of the gridlines of the axes.

  • yticks (None, array_like, matplotlib.ticker.Locator) – Longitudes and latitudes where the frame is cut. They default to the locators of the gridlines of the axes.

  • inside (bool) – Draw the frame inside the map, rather than outside

  • linewidth (None) – Properties of the thin lines that outline the frame

  • edgecolor (None) – Properties of the thin lines that outline the frame

  • zorder (None, float)

Returns:

list(matplotlib.artist.Artist) – The artists of the frame

Example

ax = create_map([-8, 0, 46, 50], gridlines=False)[1]
add_fancy_map_frame(ax, width=6)

See also

decorate_map