matplotlib.axes.Axes.set_position#

Axes.set_position(pos, which='both')[source]#

Set the Axes position.

Axes have two position attributes. The 'original' position is the position allocated for the Axes. The 'active' position is the position the Axes is actually drawn at. These positions are usually the same unless a fixed aspect is set to the Axes. See Axes.set_aspect for details.

Parameters:
pos[left, bottom, width, height] or Bbox

The new position of the Axes in Figure coordinates.

which{'both', 'active', 'original'}, default: 'both'

Determines which position variables to change.

Note

This parameter is considered internal. End users should not use it.

For native Matplotlib Axes, the active position is determined by a combination of the original position and the aspect ratio. Any active position set by the user will therefore be overwritten by internal handling. This option is retained as it may be relevant for some third party Axes subclasses.

Examples using matplotlib.axes.Axes.set_position#

Contour Demo

Contour Demo