Skip to content

Commit 297feee

Browse files
Sync271jklymak
andauthored
[Doc] consolidate rect documentation (#22820)
* consolidate rect documentation * restore explanation * fix rect definition formatting Co-Authored-By: Jody Klymak <jklymak@gmail.com> * fix trailing white space and rect definition for `add_axes()` Co-Authored-By: Jody Klymak <jklymak@gmail.com> Co-authored-by: Jody Klymak <jklymak@gmail.com>
1 parent 9fb42c9 commit 297feee

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

lib/matplotlib/_tight_layout.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def _auto_adjust_subplotpars(
4141
h_pad, w_pad : float
4242
Padding (height/width) between edges of adjacent subplots, as a
4343
fraction of the font size. Defaults to *pad*.
44-
rect : tuple[float, float, float, float]
45-
[left, bottom, right, top] in normalized (0, 1) figure coordinates.
44+
rect : tuple
45+
(left, bottom, right, top), default: None.
4646
"""
4747
rows, cols = shape
4848

@@ -183,8 +183,8 @@ def auto_adjust_subplotpars(
183183
h_pad, w_pad : float
184184
Padding (height/width) between edges of adjacent subplots, as a
185185
fraction of the font size. Defaults to *pad*.
186-
rect : tuple[float, float, float, float]
187-
[left, bottom, right, top] in normalized (0, 1) figure coordinates.
186+
rect : tuple
187+
(left, bottom, right, top), default: None.
188188
"""
189189
nrows, ncols = nrows_ncols
190190
span_pairs = []
@@ -250,8 +250,8 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
250250
h_pad, w_pad : float
251251
Padding (height/width) between edges of adjacent subplots. Defaults to
252252
*pad*.
253-
rect : tuple[float, float, float, float], optional
254-
(left, bottom, right, top) rectangle in normalized figure coordinates
253+
rect : tuple (left, bottom, right, top), default: None.
254+
rectangle in normalized figure coordinates
255255
that the whole subplots area (including labels) will fit into.
256256
Defaults to using the entire figure.
257257

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def __init__(self, fig, rect,
589589
fig : `~matplotlib.figure.Figure`
590590
The Axes is built in the `.Figure` *fig*.
591591
592-
rect : [left, bottom, width, height]
592+
rect : tuple (left, bottom, width, height).
593593
The Axes is built in the rectangle *rect*. *rect* is in
594594
`.Figure` coordinates.
595595

lib/matplotlib/figure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ def add_axes(self, *args, **kwargs):
519519
520520
Parameters
521521
----------
522-
rect : sequence of float
523-
The dimensions [left, bottom, width, height] of the new Axes. All
522+
rect : tuple (left, bottom, width, height)
523+
The dimensions (left, bottom, width, height) of the new Axes. All
524524
quantities are in fractions of figure width and height.
525525
526526
projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@ def tight_layout(self, figure, renderer=None,
460460
h_pad, w_pad : float, optional
461461
Padding (height/width) between edges of adjacent subplots.
462462
Defaults to *pad*.
463-
rect : tuple of 4 floats, default: (0, 0, 1, 1), i.e. the whole figure
463+
rect : tuple (left, bottom, right, top), default: None
464464
(left, bottom, right, top) rectangle in normalized figure
465465
coordinates that the whole subplots area (including labels) will
466-
fit into.
466+
fit into. Default (None) is the whole figure.
467467
"""
468468

469469
subplotspec_list = _tight_layout.get_subplotspec_list(

lib/matplotlib/layout_engine.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ def __init__(self, *, pad=1.08, h_pad=None, w_pad=None,
121121
h_pad, w_pad : float
122122
Padding (height/width) between edges of adjacent subplots.
123123
Defaults to *pad*.
124-
rect : tuple of 4 floats, optional
125-
(left, bottom, right, top) rectangle in normalized figure
126-
coordinates that the subplots (including labels)
127-
will fit into. Defaults to using the entire figure.
124+
rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1).
125+
rectangle in normalized figure coordinates that the subplots
126+
(including labels) will fit into.
128127
"""
129128
super().__init__(**kwargs)
130129
for td in ['pad', 'h_pad', 'w_pad', 'rect']:

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(
6363
----------
6464
fig : Figure
6565
The parent figure.
66-
rect : (float, float, float, float)
66+
rect : tuple (left, bottom, width, height), default: None.
6767
The ``(left, bottom, width, height)`` axes position.
6868
elev : float, default: 30
6969
The elevation angle in degrees rotates the camera above and below

0 commit comments

Comments
 (0)