Skip to content

Commit 4067c01

Browse files
zmoonkeewis
andauthored
FacetGrid docstrings (#5293)
Co-authored-by: keewis <keewis@users.noreply.github.com>
1 parent 504caea commit 4067c01

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ Faceting
846846
plot.FacetGrid
847847
plot.FacetGrid.add_colorbar
848848
plot.FacetGrid.add_legend
849+
plot.FacetGrid.add_quiverkey
849850
plot.FacetGrid.map
850851
plot.FacetGrid.map_dataarray
851852
plot.FacetGrid.map_dataarray_line

xarray/plot/facetgrid.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def _nicetitle(coord, value, maxchar, template):
3535

3636
class FacetGrid:
3737
"""
38-
Initialize the matplotlib figure and FacetGrid object.
38+
Initialize the Matplotlib figure and FacetGrid object.
3939
4040
The :class:`FacetGrid` is an object that links a xarray DataArray to
41-
a matplotlib figure with a particular structure.
41+
a Matplotlib figure with a particular structure.
4242
4343
In particular, :class:`FacetGrid` is used to draw plots with multiple
44-
Axes where each Axes shows the same relationship conditioned on
44+
axes, where each axes shows the same relationship conditioned on
4545
different levels of some dimension. It's possible to condition on up to
4646
two variables by assigning variables to the rows and columns of the
4747
grid.
@@ -59,19 +59,19 @@ class FacetGrid:
5959
6060
Attributes
6161
----------
62-
axes : numpy object array
63-
Contains axes in corresponding position, as returned from
64-
plt.subplots
65-
col_labels : list
66-
list of :class:`matplotlib.text.Text` instances corresponding to column titles.
67-
row_labels : list
68-
list of :class:`matplotlib.text.Text` instances corresponding to row titles.
69-
fig : matplotlib.Figure
70-
The figure containing all the axes
71-
name_dicts : numpy object array
72-
Contains dictionaries mapping coordinate names to values. None is
73-
used as a sentinel value for axes which should remain empty, ie.
74-
sometimes the bottom right grid
62+
axes : ndarray of matplotlib.axes.Axes
63+
Array containing axes in corresponding position, as returned from
64+
:py:func:`matplotlib.pyplot.subplots`.
65+
col_labels : list of matplotlib.text.Text
66+
Column titles.
67+
row_labels : list of matplotlib.text.Text
68+
Row titles.
69+
fig : matplotlib.figure.Figure
70+
The figure containing all the axes.
71+
name_dicts : ndarray of dict
72+
Array containing dictionaries mapping coordinate names to values. ``None`` is
73+
used as a sentinel value for axes that should remain empty, i.e.,
74+
sometimes the rightmost grid positions in the bottom row.
7575
"""
7676

7777
def __init__(
@@ -91,26 +91,28 @@ def __init__(
9191
Parameters
9292
----------
9393
data : DataArray
94-
xarray DataArray to be plotted
95-
row, col : strings
94+
xarray DataArray to be plotted.
95+
row, col : str
9696
Dimesion names that define subsets of the data, which will be drawn
9797
on separate facets in the grid.
9898
col_wrap : int, optional
99-
"Wrap" the column variable at this width, so that the column facets
99+
"Wrap" the grid the for the column variable after this number of columns,
100+
adding rows if ``col_wrap`` is less than the number of facets.
100101
sharex : bool, optional
101-
If true, the facets will share x axes
102+
If true, the facets will share *x* axes.
102103
sharey : bool, optional
103-
If true, the facets will share y axes
104+
If true, the facets will share *y* axes.
104105
figsize : tuple, optional
105106
A tuple (width, height) of the figure in inches.
106107
If set, overrides ``size`` and ``aspect``.
107108
aspect : scalar, optional
108109
Aspect ratio of each facet, so that ``aspect * size`` gives the
109-
width of each facet in inches
110+
width of each facet in inches.
110111
size : scalar, optional
111-
Height (in inches) of each facet. See also: ``aspect``
112+
Height (in inches) of each facet. See also: ``aspect``.
112113
subplot_kws : dict, optional
113-
Dictionary of keyword arguments for matplotlib subplots
114+
Dictionary of keyword arguments for Matplotlib subplots
115+
(:py:func:`matplotlib.pyplot.subplots`).
114116
115117
"""
116118

@@ -431,7 +433,7 @@ def add_legend(self, **kwargs):
431433
self._adjust_fig_for_guide(self.figlegend)
432434

433435
def add_colorbar(self, **kwargs):
434-
"""Draw a colorbar"""
436+
"""Draw a colorbar."""
435437
kwargs = kwargs.copy()
436438
if self._cmap_extend is not None:
437439
kwargs.setdefault("extend", self._cmap_extend)
@@ -564,7 +566,7 @@ def set_titles(self, template="{coord} = {value}", maxchar=30, size=None, **kwar
564566

565567
def set_ticks(self, max_xticks=_NTICKS, max_yticks=_NTICKS, fontsize=_FONTSIZE):
566568
"""
567-
Set and control tick behavior
569+
Set and control tick behavior.
568570
569571
Parameters
570572
----------

0 commit comments

Comments
 (0)