8000 DOC: Add numpydoc headers to colorbar.make_axes*. · matplotlib/matplotlib@664fae5 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 664fae5

Browse files
committed
DOC: Add numpydoc headers to colorbar.make_axes*.
1 parent c4f226c commit 664fae5

File tree

1 file changed

+62
-39
lines changed

1 file changed

+62
-39
lines changed

lib/matplotlib/colorbar.py

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,26 @@
5454

5555
_log = logging.getLogger(__name__)
5656

57-
make_axes_kw_doc = """
58-
59-
============= ====================================================
60-
Property Description
61-
============= ====================================================
62-
*orientation* vertical or horizontal
63-
*fraction* 0.15; fraction of original axes to use for colorbar
64-
*pad* 0.05 if vertical, 0.15 if horizontal; fraction
65-
of original axes between colorbar and new image axes
66-
*shrink* 1.0; fraction by which to multiply the size of the colorbar
67-
*aspect* 20; ratio of long to short dimensions
68-
*anchor* (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal;
69-
the anchor point of the colorbar axes
70-
*panchor* (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal;
71-
the anchor point of the colorbar parent axes. If
72-
False, the parent axes' anchor will be unchanged
73-
============= ====================================================
74-
57+
_make_axes_param_doc = """
58+
fraction : float, default: 0.15
59+
Fraction of original axes to use for colorbar.
60+
shrink : float, default: 1.0
61+
Fraction by which to multiply the size of the colorbar.
62+
aspect : float, default: 20
63+
Ratio of long to short dimensions.
64+
"""
65+
_make_axes_other_param_doc = """
66+
pad : float, default: 0.05 if vertical, 0.15 if horizontal
67+
Fraction of original axes between colorbar and new image axes.
68+
anchor : (float, float), optional
69+
The anchor point of the colorbar axes.
70+
Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal.
71+
panchor : (float, float), or *False*, optional
72+
The anchor point of the colorbar parent axes. If *False*, the parent
73+
axes' anchor will be unchanged.
74+
Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.
7575
"""
76+
make_axes_kw_doc = _make_axes_param_doc + _make_axes_other_param_doc
7677

7778
colormap_kw_doc = """
7879
@@ -1362,7 +1363,7 @@ def remove(self):
13621363
ax.set_subplotspec(subplotspec)
13631364

13641365

1365-
@docstring.Substitution(make_axes_kw_doc)
1366+
@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
13661367
def make_axes(parents, location=None, orientation=None, fraction=0.15,
13671368
shrink=1.0, aspect=20, **kw):
13681369
"""
@@ -1371,21 +1372,33 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
13711372
The axes is placed in the figure of the *parents* axes, by resizing and
13721373
repositioning *parents*.
13731374
1374-
Keyword arguments may include the following (with defaults):
1375+
Parameters
1376+
----------
1377+
parents : `~.axes.Axes` or list of `~.axes.Axes`
1378+
The Axes to use as parents for placing the colorbar.
13751379
1376-
location : None or {'left', 'right', 'top', 'bottom'}
1377-
The position, relative to *parents*, where the colorbar axes
1378-
should be created. If None, the value will either come from the
1379-
given ``orientation``, else it will default to 'right'.
1380+
location : None or {'left', 'right', 'top', 'bottom'}
1381+
The position, relative to *parents*, where the colorbar axes
1382+
should be created. If None, the value will either come from the
1383+
given ``orientation``, else it will default to 'right'.
13801384
1381-
orientation : None or {'vertical', 'horizontal'}
1382-
The orientation of the colorbar. Typically, this keyword shouldn't
1383-
be used, as it can be derived from the ``location`` keyword.
1385+
orientation : None or {'vertical', 'horizontal'}
1386+
The orientation of the colorbar. Typically, this keyword shouldn't
1387+
be used, as it can be derived from the ``location`` keyword.
13841388
13851389
%s
13861390
1387-
Returns (cax, kw), the child axes and the reduced kw dictionary to be
1388-
passed when creating the colorbar instance.
1391+
Returns
1392+
-------
1393+
cax : `~.axes.Axes`
1394+
The child axes.
1395+
kw : dict
1396+
The reduced keyword dictionary to be passed when creating the colorbar
1397+
instance.
1398+
1399+
Other Parameters
1400+
----------------
1401+
%s
13891402
"""
13901403
locations = ["left", "right", "top", "bottom"]
13911404
if orientation is not None and location is not None:
@@ -1519,7 +1532,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
15191532
return cax, kw
15201533

15211534

1522-
@docstring.Substitution(make_axes_kw_doc)
1535+
@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
15231536
def make_axes_gridspec(parent, *, fraction=0.15, shrink=1.0, aspect=20, **kw):
15241537
"""
15251538
Create a `~.SubplotBase` suitable for a colorbar.
@@ -1530,30 +1543,40 @@ def make_axes_gridspec(parent, *, fraction=0.15, shrink=1.0, aspect=20, **kw):
15301543
This function is similar to `.make_axes`. Primary differences are
15311544
15321545
- `.make_axes_gridspec` only handles the *orientation* keyword
1533-
and cannot handle the "location" keyword.
1546+
and cannot handle the *location* keyword.
15341547
15351548
- `.make_axes_gridspec` should only be used with a `.SubplotBase` parent.
15361549
15371550
- `.make_axes` creates an `~.axes.Axes`; `.make_axes_gridspec` creates a
15381551
`.SubplotBase`.
15391552
15401553
- `.make_axes` updates the position of the parent. `.make_axes_gridspec`
1541-
replaces the ``grid_spec`` attribute of the parent with a new one.
1554+
replaces the ``grid_spec`` attribute of the parent with a new one.
15421555
15431556
While this function is meant to be compatible with `.make_axes`,
15441557
there could be some minor differences.
15451558
1546-
Keyword arguments may include the following (with defaults):
1547-
1548-
*orientation*
1549-
'vertical' or 'horizontal'
1559+
Parameters
1560+
----------
1561+
parent : `~.axes.Axes`
1562+
The Axes to use as parent for placing the colorbar.
15501563
15511564
%s
15521565
1553-
All but the first of these are stripped from the input kw set.
1566+
Returns
1567+
-------
1568+
cax : `~.axes.SubplotBase`
1569+
The child axes.
1570+
kw : dict
1571+
The reduced keyword dictionary to be passed when creating the colorbar
1572+
instance.
15541573
1555-
Returns (cax, kw), the child axes and the reduced kw dictionary to be
1556-
passed when creating the colorbar instance.
1574+
Other Parameters
1575+
----------------
1576+
orientation : {'vertical', 'horizontal'}, default: 'vertical'
1577+
The orientation of the colorbar.
1578+
1579+
%s
15571580
"""
15581581

15591582
orientation = kw.setdefault('orientation', 'vertical')

0 commit comments

Comments
 (0)
0