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

Function bbox_artist

lib/matplotlib/patches.py:2356–2376  ·  view source on GitHub ↗

A debug function to draw a rectangle around the bounding box returned by an artist's `.Artist.get_window_extent` to test whether the artist is returning the correct bbox. *props* is a dict of rectangle props with the additional property 'pad' that sets the padding around the bb

(artist, renderer, props=None, fill=True)

Source from the content-addressed store, hash-verified

2354
2355
2356def bbox_artist(artist, renderer, props=None, fill=True):
2357 """
2358 A debug function to draw a rectangle around the bounding
2359 box returned by an artist's `.Artist.get_window_extent`
2360 to test whether the artist is returning the correct bbox.
2361
2362 *props* is a dict of rectangle props with the additional property
2363 'pad' that sets the padding around the bbox in points.
2364 """
2365 if props is None:
2366 props = {}
2367 props = props.copy() # don't want to alter the pad externally
2368 pad = props.pop('pad', 4)
2369 pad = renderer.points_to_pixels(pad)
2370 bbox = artist.get_window_extent(renderer)
2371 r = Rectangle(
2372 xy=(bbox.x0 - pad / 2, bbox.y0 - pad / 2),
2373 width=bbox.width + pad, height=bbox.height + pad,
2374 fill=fill, transform=transforms.IdentityTransform(), clip_on=False)
2375 r.update(props)
2376 r.draw(renderer)
2377
2378
2379def draw_bbox(bbox, renderer, color='k', trans=None):

Callers

nothing calls this directly

Calls 7

RectangleClass · 0.85
copyMethod · 0.45
popMethod · 0.45
points_to_pixelsMethod · 0.45
get_window_extentMethod · 0.45
updateMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…