xoa.plot.plot_minimap

xoa.plot.plot_minimap(obj, ax=[0.9, 0.9, 0.09], fig=None, extent=1.0, min_extent=2.0, gridlines=True, ocean_color=None, land_color=None, land_scale='110m', plot_coords='auto', coords_markersize=10, coords_linewidth=2, coords_color='tab:red', coords_facecolor=0.2, **kwargs)[source]

Plot a small map to show the geographic situation of coordinates

Parameters:
  • obj (xarray.DataArray, xarray.Dataset, tuple) – Object that contains lon and lat coordinates. The object must contains unique and identifiable geographic coordinates that can be retrieved xith xoa.coords.get_lon() and func:xoa.coords.get_lat. In case of a tuple, it should a couple of (lon, lat) xarray.DataArray.

  • ax (list, cartopy.mpl.geoaxes.GeoAxes) – A matplotlib axes instance or a list that defines the bounding box of the axes to be created [xmin, ymin, width, height] or [xmin, ymin, size] in figure coordinates.

  • fig (figure) – Figure instance

  • extent (str, float) – Either "global" for a global minimap, or the margin added to the coordinates bounding box expressed relative to the coordinates extent: a velue of 1.0 means a margin equal to the extent.

  • min_extent (None, float, (float, float)) – Minimal extent in degrees. See xoa.geo.get_extent()

  • gridlines (bool) – Add gridlines.

  • ocean_color (None, color) – A matplotlib color for oceans. If None, it defaults to cartopy.feature.COLORS["ocean"].

  • land_color (None, color) – A matplotlib color for lands. If None, it defaults to cartopy.feature.COLORS["land"].

  • plot_coords ({'auto', True, None, 'box', 'filledbox', 'points', 'lines', 'center', 'filled', False}) –

    Type of plot for coordinates

    • 'auto'|True|None: infer from coords

    • 'box': rectangle of coords extent

    • 'filledbox': filled rectangle of coords extent

    • 'points': scatter plot

    • 'lines': as lines

    • 'center': a single point at the center

    • 'filled': filled polygon

    • False: do not plot

  • coords_markersize (float) – Size of markers in "points" mode.

  • coords_linewidth (float) – Line width in "lines", “box”` and "filledbox" modes.

  • coord_color (color) – Matplotlib color.

  • coords_facecolor (color) – Matplotlib face color in "filled" and "filledbox" modes. If a float, it is interpreted as an alpha transparency that is applied to coord_color to get the face color.

  • **kwargs – Parameters matching land_<param> are passed to the function that plots lands. Parameters matching coords_<param> are passed to the function that plots coordinates. Parameters matching gridlines_<param> are passed to cartopy.mpl.geoaxes.GeoAxes.gridlines().

Returns:

cartopy.mpl.geoaxes.GeoAxes – An instance of cartopy geographic axes

Example

In [1]: ds = xr.Dataset(coords={"lon": ("station", [-7, -5, -5]), "lat": ("station", [44, 44, 46])})

In [2]: plt.plot([0, 2], [0, 2])
Out[2]: [<matplotlib.lines.Line2D at 0x7f37bc91e210>]

In [3]: plot_minimap(ds, extent="global")
Out[3]: <GeoAxes: >

In [4]: plt.figure()
Out[4]: <Figure size 640x480 with 0 Axes>

In [5]: plt.plot([0, 2], [0, 2])
Out[5]: [<matplotlib.lines.Line2D at 0x7f37bd7e3390>]

In [6]: plot_minimap(ds, extent=1.2, color="tab:green", gridlines=False, land_color="k")
Out[6]: <GeoAxes: >
../_images/api.plot.plot_minimap.global.png ../_images/api.plot.plot_minimap.regional.png