matplotlib.artist.Artist.get_window_extent#
- Artist.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, suchas changing the Axes limits, the figure size, the canvas used (as isdone when saving a figure), or the DPI.
Relying on a once-retrieved window extent can lead to unexpectedbehavior in various cases such as interactive figures being resized ormoved to a screen with different dpi, or figures that look fine onscreen render incorrectly when saved to file.
To get accurate results you may need to manually call
savefigordraw_without_renderingto haveMatplotlib 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_tightbboxGet the artist bounding box, taking clipping into account.