def bbox_artist(artist, renderer, props=None, fill=True):
if props is None: props = {}<EOL>props = props.copy() <EOL>pad = props.pop('<STR_LIT>', <NUM_LIT:4>)<EOL>pad = renderer.points_to_pixels(pad)<EOL>bbox = artist.get_window_extent(renderer)<EOL>l,b,w,h = bbox.bounds<EOL>l-=pad/<NUM_LIT><EOL>b-=pad/<NUM_LIT><EOL>w+=pad<EOL>h+=pad<EOL>r = Rectangle(xy=(l,b),<EOL>width=w,<EOL>height=h,<EOL>fill=fill,<EOL>)<EOL>r.set_transform(transforms.IdentityTransform())<EOL>r.set_clip_on( False )<EOL>r.update(props)<EOL>r.draw(renderer)<EOL>
This is a debug function to draw a rectangle around the bounding
box returned by
:meth:`~matplotlib.artist.Artist.get_window_extent` of an artist,
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 bbox in points.