matplotlib.figure.Figure.get_window_extent#
- Figure.get_window_extent(renderer=None)[source] #
Get the artist's bounding box in display space, ignoring clipping.
The bounding box's width and height are non-negative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Warning
The extent can change due to any changes in the transform stack, such as changing the Axes limits, the figure size, the canvas used (as is done when saving a figure), or the DPI.
Relying on a once-retrieved window extent can lead to unexpected behavior in various cases such as interactive figures being resized or moved to a screen with different dpi, or figures that look fine on screen render incorrectly when saved to file.
To get accurate results you may need to manually call
savefig
ordraw_without_rendering
to have Matplotlib compute the rendered size.- Parameters:
- renderer
RendererBase
, optional Renderer used to draw the figure (i.e.
fig.canvas.get_renderer()
).
- renderer
See also
Artist.get_tightbbox
Get the artist bounding box, taking clipping into account.