Repository: matplotlib/matplotlib
Pull request: [Doc] consolidate `rect` documentation
## PR Summary

Consolidate `rect` documentation. Closes #22819 

## PR Checklist

<!-- Please mark any checkboxes that do not apply to this PR as [N/A]. -->
**Tests and Styling**
- [ ] Has pytest style unit tests (and `pytest` passes).
- [x] Is [Flake 8](https://flake8.pycqa.org/en/latest/) compliant (install `flake8-docstrings` and run `flake8 --docstring-convention=all`).

**Documentation**
- [ ] New features are documented, with examples if plot related.
- [ ] New features have an entry in `doc/users/next_whats_new/` (follow instructions in README.rst there).
- [ ] API changes documented in `doc/api/next_api_changes/` (follow instructions in README.rst there).
- [x] Documentation is sphinx and numpydoc compliant (the docs should [build](https://matplotlib.org/devel/documenting_mpl.html#building-the-docs) without error).

<!--
Thank you so much for your PR!  To help us review your contribution, please
consider the following points:

- A development guide is available at https://matplotlib.org/devdocs/devel/index.html.

- Help with git and github is available at
  https://matplotlib.org/devel/gitwash/development_workflow.html.

- Do not create the PR out of main, but out of a separate branch.

- The PR title should summarize the changes, for example "Raise ValueError on
  non-numeric input to set_xlim".  Avoid non-descriptive titles such as
  "Addresses issue #8576".

- The summary should provide at least 1-2 sentences describing the pull request
  in detail (Why is this change required?  What problem does it solve?) and
  link to any relevant issues.

- If you are contributing fixes to docstrings, please pay attention to
  http://matplotlib.org/devel/documenting_mpl.html#formatting.  In particular,
  note the difference between using single backquotes, double backquotes, and
  asterisks in the markup.

We understand that PRs can sometimes be overwhelming, especially as the
reviews start coming in.  Please let us know if the reviews are unclear or
the recommended next step seems overly demanding, if you would like help in
addressing a reviewer's comments, or if you have been waiting too long to hear
back on your PR.
-->


Problem statement:
[Doc]: Make rect argument consistent in the docstrings
### Documentation Link

_No response_

### Problem

The `rect` argument to functions is inconsistently documented in the codebase. We should consolidate the argument into a single choice.

The options I found searching for `rect : ` are:
```bash
rect : tuple[float, float, float, float], optional
rect : sequence of float
rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1)
rect : tuple of 4 floats, default: (0, 0, 1, 1)
rect : [left, bottom, width, height]
rect : (float, float, float, float)
```

### Suggested improvement

Update all `rect` arguments to a single choice of one of the above for consistency.

Hints from issue discussion:
I'd like to work on this.

Below, while creating an instance of  `Grid`, it not only accepts a tuple but also an integer. Do I not touch the integer part and just make changes to the documentation of the tuple?
https://github.com/matplotlib/matplotlib/blob/2df11ccd4221d4a1d7001ab374e44f8f3c51316f/lib/mpl_toolkits/axes_grid1/axes_grid.py#L86-L88

Commit message: Merge branch 'main' into consolidate-rect-documentation

Patch to review:
diff --git a/lib/matplotlib/_tight_layout.py b/lib/matplotlib/_tight_layout.py
index 81465f9b5db6..055f3fce04e4 100644
--- a/lib/matplotlib/_tight_layout.py
+++ b/lib/matplotlib/_tight_layout.py
@@ -41,8 +41,8 @@ def _auto_adjust_subplotpars(
     h_pad, w_pad : float
         Padding (height/width) between edges of adjacent subplots, as a
         fraction of the font size.  Defaults to *pad*.
-    rect : tuple[float, float, float, float]
-        [left, bottom, right, top] in normalized (0, 1) figure coordinates.
+    rect : tuple
+        (left, bottom, right, top), default: None.
     """
     rows, cols = shape
 
@@ -183,8 +183,8 @@ def auto_adjust_subplotpars(
     h_pad, w_pad : float
         Padding (height/width) between edges of adjacent subplots, as a
         fraction of the font size.  Defaults to *pad*.
-    rect : tuple[float, float, float, float]
-        [left, bottom, right, top] in normalized (0, 1) figure coordinates.
+    rect : tuple
+        (left, bottom, right, top), default: None.
     """
     nrows, ncols = nrows_ncols
     span_pairs = []
@@ -262,8 +262,8 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
     h_pad, w_pad : float
         Padding (height/width) between edges of adjacent subplots.  Defaults to
         *pad*.
-    rect : tuple[float, float, float, float], optional
-        (left, bottom, right, top) rectangle in normalized figure coordinates
+    rect : tuple (left, bottom, right, top), default: None.
+        rectangle in normalized figure coordinates
         that the whole subplots area (including labels) will fit into.
         Defaults to using the entire figure.
 
diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py
index 6daad3ca450a..c1d3a8d97d23 100644
--- a/lib/matplotlib/axes/_base.py
+++ b/lib/matplotlib/axes/_base.py
@@ -582,7 +582,7 @@ def __init__(self, fig, rect,
         fig : `~matplotlib.figure.Figure`
             The Axes is built in the `.Figure` *fig*.
 
-        rect : [left, bottom, width, height]
+        rect : tuple (left, bottom, width, height).
             The Axes is built in the rectangle *rect*. *rect* is in
             `.Figure` coordinates.
 
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py
index 0b8ad9828b3d..c80471fa1717 100644
--- a/lib/matplotlib/figure.py
+++ b/lib/matplotlib/figure.py
@@ -519,8 +519,8 @@ def add_axes(self, *args, **kwargs):
 
         Parameters
         ----------
-        rect : sequence of float
-            The dimensions [left, bottom, width, height] of the new Axes. All
+        rect : tuple (left, bottom, right, top)
+            The dimensions (left, bottom, right, top) of the new Axes. All
             quantities are in fractions of figure width and height.
 
         projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py
index 90d0b57b609b..fcf7b8576139 100644
--- a/lib/matplotlib/gridspec.py
+++ b/lib/matplotlib/gridspec.py
@@ -460,7 +460,7 @@ def tight_layout(self, figure, renderer=None,
         h_pad, w_pad : float, optional
             Padding (height/width) between edges of adjacent subplots.
             Defaults to *pad*.
-        rect : tuple of 4 floats, default: (0, 0, 1, 1), i.e. the whole figure
+        rect : tuple (left, bottom, right, top), default: None. i.e. the whole figure
             (left, bottom, right, top) rectangle in normalized figure
             coordinates that the whole subplots area (including labels) will
             fit into.
diff --git a/lib/matplotlib/layout_engine.py b/lib/matplotlib/layout_engine.py
index fa4281a2ba02..a5c40c5014cf 100644
--- a/lib/matplotlib/layout_engine.py
+++ b/lib/matplotlib/layout_engine.py
@@ -123,10 +123,9 @@ def __init__(self, *, pad=1.08, h_pad=None, w_pad=None,
         h_pad, w_pad : float
             Padding (height/width) between edges of adjacent subplots.
             Defaults to *pad*.
-        rect : tuple of 4 floats, optional
-            (left, bottom, right, top) rectangle in normalized figure
-            coordinates that the subplots (including labels)
-            will fit into. Defaults to using the entire figure.
+        rect : tuple (left, bottom, right, top), default: (0, 0, 1, 1).
+            rectangle in normalized figure coordinates that the subplots (including labels)
+            will fit into.
         """
         super().__init__(**kwargs)
         for td in ['pad', 'h_pad', 'w_pad', 'rect']:
diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py
index fb93342f49ae..38b86096b776 100644
--- a/lib/mpl_toolkits/mplot3d/axes3d.py
+++ b/lib/mpl_toolkits/mplot3d/axes3d.py
@@ -63,7 +63,7 @@ def __init__(
         ----------
         fig : Figure
             The parent figure.
-        rect : (float, float, float, float)
+        rect : tuple (left, bottom, width, height), default: None.
             The ``(left, bottom, width, height)`` axes position.
         elev : float, default: 30
             The elevation angle in degrees rotates the camera above and below


Code review comments:
diff_hunk: @@ -460,7 +460,7 @@ def tight_layout(self, figure, renderer=None,
         h_pad, w_pad : float, optional
             Padding (height/width) between edges of adjacent subplots.
             Defaults to *pad*.
-        rect : tuple of 4 floats, default: (0, 0, 1, 1), i.e. the whole figure
+        rect : tuple (left, bottom, right, top), default: None. i.e. the whole figure
path: lib/matplotlib/gridspec.py
text: @user1:
```suggestion
        rect : tuple (left, bottom, right, top), default: None.
```

@user2:
Leave out the trailing `.` as well.

diff_hunk: @@ -519,8 +519,8 @@ def add_axes(self, *args, **kwargs):
 
         Parameters
         ----------
-        rect : sequence of float
-            The dimensions [left, bottom, width, height] of the new Axes. All
+        rect : tuple (left, bottom, right, top)
+            The dimensions (left, bottom, right, top) of the new Axes. All
path: lib/matplotlib/figure.py
text: @user1:
Pretty sure this change is incorrect.

@author:
What would be the correct way to put `[x_min, y_min, dx, dy]`?

@user1:
I think its (left, bottom, width, height)?

diff_hunk: @@ -460,7 +460,7 @@ def tight_layout(self, figure, renderer=None,
         h_pad, w_pad : float, optional
             Padding (height/width) between edges of adjacent subplots.
             Defaults to *pad*.
-        rect : tuple of 4 floats, default: (0, 0, 1, 1), i.e. the whole figure
+        rect : tuple (left, bottom, right, top), default: None. i.e. the whole figure
             (left, bottom, right, top) rectangle in normalized figure
             coordinates that the whole subplots area (including labels) will
             fit into.
path: lib/matplotlib/gridspec.py
text: @user1:
```suggestion
            fit into.  Default (None) is the whole figure.
```