MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_box_aspect

Method set_box_aspect

lib/matplotlib/axes/_base.py:1855–1890  ·  view source on GitHub ↗

Set the Axes box aspect, i.e. the ratio of height to width. This defines the aspect of the Axes in figure space and is not to be confused with the data aspect (see `~.Axes.set_aspect`). Parameters ---------- aspect : float or None Change

(self, aspect=None)

Source from the content-addressed store, hash-verified

1853 return self._box_aspect
1854
1855 def set_box_aspect(self, aspect=None):
1856 """
1857 Set the Axes box aspect, i.e. the ratio of height to width.
1858
1859 This defines the aspect of the Axes in figure space and is not to be
1860 confused with the data aspect (see `~.Axes.set_aspect`).
1861
1862 Parameters
1863 ----------
1864 aspect : float or None
1865 Changes the physical dimensions of the Axes, such that the ratio
1866 of the Axes height to the Axes width in physical units is equal to
1867 *aspect*. Defining a box aspect will change the *adjustable*
1868 property to 'datalim' (see `~.Axes.set_adjustable`).
1869
1870 *None* will disable a fixed box aspect so that height and width
1871 of the Axes are chosen independently.
1872
1873 See Also
1874 --------
1875 matplotlib.axes.Axes.set_aspect
1876 for a description of aspect handling.
1877 """
1878 axs = {*self._twinned_axes.get_siblings(self),
1879 *self._twinned_axes.get_siblings(self)}
1880
1881 if aspect is not None:
1882 aspect = float(aspect)
1883 # when box_aspect is set to other than ´None`,
1884 # adjustable must be "datalim"
1885 for ax in axs:
1886 ax.set_adjustable("datalim")
1887
1888 for ax in axs:
1889 ax._box_aspect = aspect
1890 ax.stale = True
1891
1892 def get_anchor(self):
1893 """

Callers 15

__init__Method · 0.95
reposition_colorbarFunction · 0.45
__call__Method · 0.45
make_axesFunction · 0.45
make_axes_gridspecFunction · 0.45
test_box_aspectFunction · 0.45
test_compressed_suptitleFunction · 0.45
test_nonuniform_logscaleFunction · 0.45
figure_3D_array_slicesFunction · 0.45
view_planes_3d.pyFile · 0.45

Calls 2

set_adjustableMethod · 0.80
get_siblingsMethod · 0.45

Tested by 5

test_box_aspectFunction · 0.36
test_compressed_suptitleFunction · 0.36
test_nonuniform_logscaleFunction · 0.36