Skip to content

Commit f1e40fa

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 f1e40fa

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

lib/matplotlib/artist.py

Lines changed: 18 additions & 8 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
@@ -345,24 +344,35 @@ def get_window_extent(self, renderer=None):
345344
`matplotlib.figure.Figure.draw_without_rendering` to have Matplotlib
346345
compute the rendered size.
347346
347+
Parameters
348+
----------
349+
renderer : `~matplotlib.backend_bases.RendererBase`, optional
350+
Renderer used to draw the figure (i.e. ``fig.canvas.get_renderer()``).
351+
352+
See Also
353+
--------
354+
get_tightbbox : 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
364370
The enclosing bounding box (in figure pixel coordinates).
365371
Returns None if clipping results in no intersection.
372+
373+
See Also
374+
--------
375+
get_window_extent : Get the artist bounding box, ignoring clipping.
366376
"""
367377
bbox = self.get_window_extent(renderer)
368378
if self.get_clip_on():

0 commit comments

Comments
 (0)