matplotlib.axes.Axes.set_anchor#

Axes.set_anchor(anchor, share=False)[source]#

Define the anchor location.

The actual drawing area (active position) of the Axes may be smaller than the Bbox (original position) when a fixed aspect is required. The anchor defines where the drawing area will be located within the available space.

Parameters:
anchor(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

Either an (x, y) pair of relative coordinates (0 is left or bottom, 1 is right or top), 'C' (center), or a cardinal direction ('SW', southwest, is bottom left, etc.). str inputs are shorthands for (x, y) coordinates, as shown in the following diagram:

┌─────────────────┬─────────────────┬─────────────────┐
│ 'NW' (0.0, 1.0) │ 'N' (0.5, 1.0)  │ 'NE' (1.0, 1.0) │
├─────────────────┼─────────────────┼─────────────────┤
│ 'W'  (0.0, 0.5) │ 'C' (0.5, 0.5)  │ 'E'  (1.0, 0.5) │
├─────────────────┼─────────────────┼─────────────────┤
│ 'SW' (0.0, 0.0) │ 'S' (0.5, 0.0)  │ 'SE' (1.0, 0.0) │
└─────────────────┴─────────────────┴─────────────────┘
sharebool, default: False

If True, apply the settings to all shared Axes.

See also

matplotlib.axes.Axes.set_aspect

for a description of aspect handling.