8000 Merge main and "other" params docs in colorbar.make_axes. · matplotlib/matplotlib@2b2ce9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b2ce9b

Browse files
committed
Merge main and "other" params docs in colorbar.make_axes.
`colorbar.make_axes` (and `make_axes_gridspec`) are low-level enough that it's not worth the complexity in docstring interpolation to split out "main" parameters and "other" parameters, when the docstring of the more commonly used `plt.colorbar` smashes them together. (Also, `pad` is not really much more low-level than `shrink` or `aspect`...)
1 parent 76012ae commit 2b2ce9b

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

lib/matplotlib/colorbar.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
_log = logging.getLogger(__name__)
3131

32-
_make_axes_param_doc = """
32+
_make_axes_kw_doc = """
3333
location : None or {'left', 'right', 'top', 'bottom'}
3434
The location, relative to the parent axes, where the colorbar axes
3535
is created. It also determines the *orientation* of the colorbar
@@ -47,8 +47,6 @@
4747
Fraction by which to multiply the size of the colorbar.
4848
aspect : float, default: 20
4949
Ratio of long to short dimensions.
50-
"""
51-
_make_axes_other_param_doc = """
5250
pad : float, default: 0.05 if vertical, 0.15 if horizontal
5351
Fraction of original axes between colorbar and new image axes.
5452
anchor : (float, float), optional
@@ -161,7 +159,6 @@
161159
Additional keyword arguments are of two kinds:
162160
163161
axes properties:
164-
%s
165162
%s
166163
colorbar properties:
167164
%s
@@ -189,9 +186,7 @@
189186
However this has negative consequences in other circumstances, e.g. with
190187
semi-transparent images (alpha < 1) and colorbar extensions; therefore, this
191188
workaround is not used by default (see issue #1188).
192-
""" % (textwrap.indent(_make_axes_param_doc, " "),
193-
textwrap.indent(_make_axes_other_param_doc, " "),
194-
_colormap_kw_doc))
189+
""" % (textwrap.indent(_make_axes_kw_doc, " "), _colormap_kw_doc))
195190

196191

197192
def _set_ticks_on_axis_warn(*args, **kwargs):
@@ -1364,7 +1359,7 @@ def _normalize_location_orientation(location, orientation):
13641359
return loc_settings
13651360

13661361

1367-
@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
1362+
@docstring.Substitution(_make_axes_kw_doc)
13681363
def make_axes(parents, location=None, orientation=None, fraction=0.15,
13691364
shrink=1.0, aspect=20, **kwargs):
13701365
"""
@@ -1386,10 +1381,6 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
13861381
kwargs : dict
13871382
The reduced keyword dictionary to be passed when creating the colorbar
13881383
instance.
1389-
1390-
Other Parameters
1391-
----------------
1392-
%s
13931384
"""
13941385
loc_settings = _normalize_location_orientation(location, orientation)
13951386
# put appropriate values into the kwargs dict for passing back to
@@ -1470,7 +1461,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
14701461
return cax, kwargs
14711462

14721463

1473-
@docstring.Substitution(_make_axes_param_doc, _make_axes_other_param_doc)
1464+
@docstring.Substitution(_make_axes_kw_doc)
14741465
def make_axes_gridspec(parent, *, location=None, orientation=None,
14751466
fraction=0.15, shrink=1.0, aspect=20, **kwargs):
14761467
"""
@@ -1505,10 +1496,6 @@ def make_axes_gridspec(parent, *, location=None, orientation=None,
15051496
kwargs : dict
15061497
The reduced keyword dictionary to be passed when creating the colorbar
15071498
instance.
1508-
1509-
Other Parameters
1510-
----------------
1511-
%s
15121499
"""
15131500

15141501
loc_settings = _normalize_location_orientation(location, orientation)

0 commit comments

Comments
 (0)
0