Matplotlib.axes.Axes.get_window_extent() in Python
Last Updated :
28 Apr, 2025
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
matplotlib.axes.Axes.get_window_extent() Function
The Axes.get_window_extent() function in axes module of matplotlib library is used to return the axes bounding box in display spaced.
Syntax: Axes.get_window_extent(self, \*args, \*\*kwargs) Here, args and kwargs are empty.
Parameters: This method does not accepts any parameters.
Returns: This method return the axes bounding box in display space.
Below examples illustrate the matplotlib.axes.Axes.get_window_extent() function in matplotlib.axes:
Example 1:
Python3
# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
X = np.arange(-10, 10, 0.5)
Y = np.arange(-10, 10, 0.5)
U, V = np.meshgrid(X, Y)
fig, ax = plt.subplots()
ax.quiver(X, Y, U, V)
ax.invert_xaxis()
w = ax.get_window_extent()
print(str(w))
fig.suptitle('matplotlib.axes.Axes.get_window_extent()\
function Example', fontweight ="bold")
plt.show()
Output:

TransformedBbox(
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),
BboxTransformTo(
TransformedBbox(
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),
Affine2D(
[[100. 0. 0.]
[ 0. 100. 0.]
[ 0. 0. 1.]]))))
Example 2:
Python3
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
xx = np.random.rand(16, 30)
fig, ax3 = plt.subplots()
m = ax3.pcolor(xx)
m.set_zorder(-20)
w = ax3.get_window_extent()
print(str(w))
fig.suptitle('matplotlib.axes.Axes.get_window_extent() \
function Example', fontweight ="bold")
plt.show()
Output:

TransformedBbox(
Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),
BboxTransformTo(
TransformedBbox(
Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),
Affine2D(
[[100. 0. 0.]
[ 0. 100. 0.]
[ 0. 0. 1.]]))))
Similar Reads
Matplotlib.axis.Axis.get_window_extent() function in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. Matplotlib.axis.Axis.get_window_extent() Function The Axis.get_window_extent()
2 min read
Matplotlib.artist.Artist.get_window_extent() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The Artist class contains Abstract base class for objects that render into a FigureCanvas. All visible elements in a figure are subclasses of Artist. Matplotlib.artist.Artist.get_window_extent() Method
2 min read
Matplotlib.axes.Axes.get_data_ratio() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
2 min read
Matplotlib.axes.Axes.get_xbound() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
2 min read
Matplotlib.axes.Axes.get_ylim() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
2 min read
Matplotlib.axes.Axes.get_xlim() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
2 min read