Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 703cc5f

Browse files
authored
Merge pull request #17726 from timhoffm/doc-box-aspect
Clarify docs of box_aspect()
2 parents 7d6f355 + c13790e commit 703cc5f

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ def __init__(self, fig, rect,
461461
frameon : bool, default: True
462462
Whether the axes frame is visible.
463463
464-
box_aspect : None, or a number, optional
465-
Sets the aspect of the axes box. See `~.axes.Axes.set_box_aspect`
466-
for details.
464+
box_aspect : float, optional
465+
Set a fixed aspect for the axes box, i.e. the ratio of height to
466+
width. See `~.axes.Axes.set_box_aspect` for details.
467467
468468
**kwargs
469469
Other optional keyword arguments:
@@ -1422,8 +1422,10 @@ def set_adjustable(self, adjustable, share=False):
14221422

14231423
def get_box_aspect(self):
14241424
"""
1425-
Get the axes box aspect.
1426-
Will be ``None`` if not explicitly specified.
1425+
Return the axes box aspect, i.e. the ratio of height to width.
1426+
1427+
The box aspect is ``None`` (i.e. chosen depending on the available
1428+
figure space) unless explicitly specified.
14271429
14281430
See Also
14291431
--------
@@ -1436,19 +1438,21 @@ def get_box_aspect(self):
14361438

14371439
def set_box_aspect(self, aspect=None):
14381440
"""
1439-
Set the axes box aspect. The box aspect is the ratio of the
1440-
axes height to the axes width in physical units. This is not to be
1441-
confused with the data aspect, set via `~.Axes.set_aspect`.
1441+
Set the axes box aspect, i.e. the ratio of height to width.
1442+
1443+
This defines the aspect of the axes in figure space and is not to be
1444+
confused with the data aspect (see `~.Axes.set_aspect`).
14421445
14431446
Parameters
14441447
----------
1445-
aspect : None, or a number
1448+
aspect : float or None
14461449
Changes the physical dimensions of the Axes, such that the ratio
14471450
of the axes height to the axes width in physical units is equal to
1448-
*aspect*. If *None*, the axes geometry will not be adjusted.
1451+
*aspect*. Defining a box aspect will change the *adjustable*
1452+
property to 'datalim' (see `~.Axes.set_adjustable`).
14491453
1450-
Note that calling this function with a number changes the *adjustable*
1451-
to *datalim*.
1454+
*None* will disable a fixed box aspect so that height and width
1455+
of the axes are chosen independently.
14521456
14531457
See Also
14541458
--------

0 commit comments

Comments
 (0)