Skip to content

Commit e78735b

Browse files
committed
Tweak docstrings of get_window_extent/get_tightbbox.
Make the difference between the two methods clearer (only the latter takes clipping into account).
1 parent 73d0317 commit e78735b

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

lib/matplotlib/artist.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,12 @@ def stale(self, val):
321321

322322
def get_window_extent(self, renderer=None):
323323
"""
324-
Get the artist's bounding box in display space.
324+
Get the artist's bounding box in display space, ignoring clipping.
325325
326326
The bounding box's width and height are non-negative.
327327
328-
Subclasses should override for inclusion in the bounding box
329-
"tight" calculation. Default is to return an empty bounding
330-
box at 0, 0.
328+
Subclasses should override for inclusion in the bounding box "tight"
329+
calculation. Default is to return an empty bounding box at 0, 0.
331330
332331
.. warning::
333332
@@ -341,28 +340,40 @@ def get_window_extent(self, renderer=None):
341340
screen render incorrectly when saved to file.
342341
343342
To get accurate results you may need to manually call
344-
`matplotlib.figure.Figure.savefig` or
345-
`matplotlib.figure.Figure.draw_without_rendering` to have Matplotlib
346-
compute the rendered size.
343+
`~.Figure.savefig` or `~.Figure.draw_without_rendering` to have
344+
Matplotlib compute the rendered size.
347345
346+
Parameters
347+
----------
348+
renderer : `~matplotlib.backend_bases.RendererBase`, optional
349+
Renderer used to draw the figure (i.e. ``fig.canvas.get_renderer()``).
350+
351+
See Also
352+
--------
353+
`~.Artist.get_tightbbox` :
354+
Get the artist bounding box, taking clipping into account.
348355
"""
349356
return Bbox([[0, 0], [0, 0]])
350357

351358
def get_tightbbox(self, renderer=None):
352359
"""
353-
Like `.Artist.get_window_extent`, but includes any clipping.
360+
Get the artist's bounding box in display space, taking clipping into account.
354361
355362
Parameters
356363
----------
357-
renderer : `~matplotlib.backend_bases.RendererBase` subclass, optional
358-
renderer that will be used to draw the figures (i.e.
359-
``fig.canvas.get_renderer()``)
364+
renderer : `~matplotlib.backend_bases.RendererBase`, optional
365+
Renderer used to draw the figure (i.e. ``fig.canvas.get_renderer()``).
360366
361367
Returns
362368
-------
363369
`.Bbox` or None
364-
The enclosing bounding box (in figure pixel coordinates).
365-
Returns None if clipping results in no intersection.
370+
The enclosing bounding box (in figure pixel coordinates), or None
371+
if clipping results in no intersection.
372+
373+
See Also
374+
--------
375+
`~.Artist.get_window_extent` :
376+
Get the artist bounding box, ignoring clipping.
366377
"""
367378
bbox = self.get_window_extent(renderer)
368379
if self.get_clip_on():

0 commit comments

Comments
 (0)