MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_tightbbox

Method get_tightbbox

lib/matplotlib/artist.py:373–402  ·  view source on GitHub ↗

Get the artist's bounding box in display space, taking clipping into account. Parameters ---------- renderer : `~matplotlib.backend_bases.RendererBase`, optional Renderer used to draw the figure (i.e. ``fig.canvas.get_renderer()``). Returns

(self, renderer=None)

Source from the content-addressed store, hash-verified

371 return Bbox([[0, 0], [0, 0]])
372
373 def get_tightbbox(self, renderer=None):
374 """
375 Get the artist's bounding box in display space, taking clipping into account.
376
377 Parameters
378 ----------
379 renderer : `~matplotlib.backend_bases.RendererBase`, optional
380 Renderer used to draw the figure (i.e. ``fig.canvas.get_renderer()``).
381
382 Returns
383 -------
384 `.Bbox` or None
385 The enclosing bounding box (in figure pixel coordinates), or None
386 if clipping results in no intersection.
387
388 See Also
389 --------
390 .Artist.get_window_extent :
391 Get the artist bounding box, ignoring clipping.
392 """
393 bbox = self.get_window_extent(renderer)
394 if self.get_clip_on():
395 clip_box = self.get_clip_box()
396 if clip_box is not None:
397 bbox = Bbox.intersection(bbox, clip_box)
398 clip_path = self.get_clip_path()
399 if clip_path is not None and bbox is not None:
400 clip_path = clip_path.get_fully_transformed_path()
401 bbox = Bbox.intersection(bbox, clip_path.get_extents())
402 return bbox
403
404 def add_callback(self, func):
405 """

Callers 1

Calls 7

get_window_extentMethod · 0.95
get_clip_onMethod · 0.95
get_clip_boxMethod · 0.95
get_clip_pathMethod · 0.95
intersectionMethod · 0.80
get_extentsMethod · 0.45

Tested by

no test coverage detected