Skip to content

Commit

Permalink
Merge pull request #157 from zmoon/doc
Browse files Browse the repository at this point in the history
Add links in plotting docstrings
  • Loading branch information
zmoon authored Sep 19, 2024
2 parents 2893337 + d57f728 commit ad5abe3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __getattr__(cls, name):
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"monetio": ("https://monetio.readthedocs.io/en/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
}


Expand Down
36 changes: 17 additions & 19 deletions monet/monet_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,21 +960,20 @@ def _check_kwargs_and_set_defaults(**kwargs):
return kwargs

def quick_imshow(self, map_kws=None, roll_dateline=False, **kwargs):
"""This function takes an xarray DataArray and quickly creates a figure
using cartopy and matplotlib ``imshow``.
"""Quickly create a geo-referenced image plot using Cartopy and Matplotlib.
Note that this should only be used for regular grids.
Note that this should only be used for regular grids (e.g. rectangular lat/lon grid).
Parameters
----------
map_kws : dictionary
kwargs for monet.plots.mapgen.draw_map
map_kws : dict
kwargs for :func:`monet.plots.mapgen.draw_map`
roll_dateline : bool
roll_dateline is meant to help with global datasets that the longitudes
`roll_dateline` is meant to help with global datasets that the longitudes
range from 0 to 360 instead of -180 to 180. Otherwise a white line appears
at 0 degrees.
**kwargs :
kwargs for the xarray.DataArray.plot.imshow function
kwargs for :meth:`xarray.DataArray.plot.imshow`
Returns
-------
Expand Down Expand Up @@ -1028,19 +1027,19 @@ def quick_imshow(self, map_kws=None, roll_dateline=False, **kwargs):
return ax

def quick_map(self, map_kws=None, roll_dateline=False, **kwargs):
"""This function takes an xarray DataArray and quickly creates a figure
using cartopy and matplotlib ``pcolormesh``.
"""Quickly create a geo-referenced plot using Cartopy and Matplotlib.
Parameters
----------
map_kws : dictionary
kwargs for monet.plots.mapgen.draw_map
map_kws : dict
kwargs for :func:`monet.plots.mapgen.draw_map`
roll_dateline : bool
roll_dateline is meant to help with global datasets that the longitudes
`roll_dateline` is meant to help with global datasets that the longitudes
range from 0 to 360 instead of -180 to 180. Otherwise a white line appears
at 0 degrees.
**kwargs :
kwargs for the xarray.DataArray.plot.pcolormesh function
kwargs for :meth:`xarray.DataArray.plot.pcolormesh`
(actually passed to :meth:`xarray.DataArray.plot`, but pcolormesh is the usual result)
Returns
-------
Expand Down Expand Up @@ -1087,19 +1086,18 @@ def quick_map(self, map_kws=None, roll_dateline=False, **kwargs):
return ax

def quick_contourf(self, map_kws=None, roll_dateline=False, **kwargs):
"""This function takes an xarray DataArray and quickly creates a figure
using cartopy and matplotlib ``contourf``.
"""Quickly create a geo-referenced filled-contour plot using Cartopy and Matplotlib.
Parameters
----------
map_kws : dictionary
kwargs for monet.plots.mapgen.draw_map
map_kws : dict
kwargs for :func:`monet.plots.mapgen.draw_map`
roll_dateline : bool
roll_dateline is meant to help with global datasets that the longitudes
`roll_dateline` is meant to help with global datasets that the longitudes
range from 0 to 360 instead of -180 to 180. Otherwise a white line appears
at 0 degrees.
**kwargs :
kwargs for the xarray.DataArray.plot.contourf function
kwargs for :meth:`xarray.DataArray.plot.contourf`
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions monet/plots/mapgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def draw_map(
extent : array-like
Set the map extent with ``[lon_min,lon_max,lat_min,lat_max]``.
figsize : tuple
Figure size (width, height), passed to ``plt.subplots()``.
Figure size (width, height), passed to :func:`plt.subplots() <matplotlib.pyplot.subplots>`.
This takes precedence over the possible ``kwargs['figsize']``.
linewidth : float
Line width for coastlines, states, counties, and countries.
return_fig : bool
Return the figure and axes objects.
By default (``False``), just the axes object is returned.
**kwargs
Arguments pass to ``plt.subplots()``.
Arguments to pass to :func:`plt.subplots() <matplotlib.pyplot.subplots>`.
Returns
-------
Expand Down

0 comments on commit ad5abe3

Please sign in to comment.