On this page
matplotlib.axes.Axes.set_aspect
Axes.
set_aspect
(aspect, adjustable=None, anchor=None, share=False)-
Set the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit.
Parameters: - aspect{'auto', 'equal'} or float
-
Possible values:
- 'auto': fill the position rectangle with data.
- 'equal': same as
aspect=1
, i.e. same scaling for x and y. - float: A circle will be stretched such that the height is float times the width.
- adjustableNone or {'box', 'datalim'}, optional
-
If not
None
, this defines which parameter will be adjusted to meet the required aspect. Seeset_adjustable
for further details. - anchorNone or str or (float, float), optional
-
If not
None
, this defines where the Axes will be drawn if there is extra space due to aspect constraints. The most common way to to specify the anchor are abbreviations of cardinal directions:value description 'C' centered 'SW' lower left corner 'S' middle of bottom edge 'SE' lower right corner etc. See
set_anchor
for further details. - sharebool, default: False
-
If
True
, apply the settings to all shared Axes.
See also
-
matplotlib.axes.Axes.set_adjustable
- Set how the Axes adjusts to achieve the required aspect ratio.
-
matplotlib.axes.Axes.set_anchor
- Set the position in case of extra space.
Examples using matplotlib.axes.Axes.set_aspect
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.4.3/api/_as_gen/matplotlib.axes.Axes.set_aspect.html