Skip to content Skip to sidebar Skip to footer

Relative Coordinates Using Get And Set Axes Methods In Matplotlib

One way to control where in the figure object a new axes is supposed to go is by using the add_axes method. This method takes in a list or tuple of 4 values which represent [left,

Solution 1:

The figure's add_axes method takes as argument a rect

add_axes(*args, **kwargs) Add an axes at position rect [left, bottom, width, height]

axes.get_position() returns a BBox object. This has, as seen from its documentation, a property

bounds (property) Returns (x0, y0, width, height).

Hence you want to call

ax.get_position().bounds

To obtain the the boundaries of the rectangle of the axes.

Post a Comment for "Relative Coordinates Using Get And Set Axes Methods In Matplotlib"