Set the aspect ratio of the Axes scaling, i.e. y/x-scale. Parameters ---------- aspect : {'auto', 'equal'} or float Possible values: - 'auto': fill the position rectangle with data. - 'equal': same as ``aspect=1``, i.e. same scal
(self, aspect, adjustable=None, anchor=None, share=False)
| 1689 | return self._aspect |
| 1690 | |
| 1691 | def set_aspect(self, aspect, adjustable=None, anchor=None, share=False): |
| 1692 | """ |
| 1693 | Set the aspect ratio of the Axes scaling, i.e. y/x-scale. |
| 1694 | |
| 1695 | Parameters |
| 1696 | ---------- |
| 1697 | aspect : {'auto', 'equal'} or float |
| 1698 | Possible values: |
| 1699 | |
| 1700 | - 'auto': fill the position rectangle with data. |
| 1701 | - 'equal': same as ``aspect=1``, i.e. same scaling for x and y. |
| 1702 | - *float*: The displayed size of 1 unit in y-data coordinates will |
| 1703 | be *aspect* times the displayed size of 1 unit in x-data |
| 1704 | coordinates; e.g. for ``aspect=2`` a square in data coordinates |
| 1705 | will be rendered with a height of twice its width. |
| 1706 | |
| 1707 | adjustable : None or {'box', 'datalim'}, optional |
| 1708 | If not ``None``, this defines which parameter will be adjusted to |
| 1709 | meet the required aspect. See `.set_adjustable` for further |
| 1710 | details. |
| 1711 | |
| 1712 | anchor : None or str or (float, float), optional |
| 1713 | If not ``None``, this defines where the Axes will be drawn if there |
| 1714 | is extra space due to aspect constraints. The most common way |
| 1715 | to specify the anchor are abbreviations of cardinal directions: |
| 1716 | |
| 1717 | ===== ===================== |
| 1718 | value description |
| 1719 | ===== ===================== |
| 1720 | 'C' centered |
| 1721 | 'SW' lower left corner |
| 1722 | 'S' middle of bottom edge |
| 1723 | 'SE' lower right corner |
| 1724 | etc. |
| 1725 | ===== ===================== |
| 1726 | |
| 1727 | See `~.Axes.set_anchor` for further details. |
| 1728 | |
| 1729 | share : bool, default: False |
| 1730 | If ``True``, apply the settings to all shared Axes. |
| 1731 | |
| 1732 | Notes |
| 1733 | ----- |
| 1734 | The aspect will require an update of the Axes position or limits (which |
| 1735 | one depends on *adjustable*). This update is applied lazily, the latest |
| 1736 | when the figure is drawn. Use `.apply_aspect` to force an update. |
| 1737 | |
| 1738 | See Also |
| 1739 | -------- |
| 1740 | matplotlib.axes.Axes.set_adjustable |
| 1741 | Set how the Axes adjusts to achieve the required aspect ratio. |
| 1742 | matplotlib.axes.Axes.set_anchor |
| 1743 | Set the position in case of extra space. |
| 1744 | matplotlib.axes.Axes.apply_aspect |
| 1745 | Force the update required to meet the aspect ratio to happen |
| 1746 | immediately. |
| 1747 | """ |
| 1748 | if cbook._str_equal(aspect, 'equal'): |