def bbox_artist(artist, renderer, props=None, fill=True):
 if (props is None):
  props = {}
 props = props.copy()
 pad = props.pop('pad', 4)
 pad = renderer.points_to_pixels(pad)
 bbox = artist.get_window_extent(renderer)
 (l, b, w, h) = bbox.bounds
 l -= (pad / 2.0)
 b -= (pad / 2.0)
 w += pad
 h += pad
 r = Rectangle(xy=(l, b), width=w, height=h, fill=fill)
 r.set_transform(transforms.IdentityTransform())
 r.set_clip_on(False)
 r.update(props)
 r.draw(renderer)

def bbox_artist ( artist , renderer , props = None , fill = True ) : if ( props is None ) : props = { } props = props . copy ( ) pad = props . pop ( 'pad' , 4 ) pad = renderer . points_to_pixels ( pad ) bbox = artist . get_window_extent ( renderer ) ( l , b , w , h ) = bbox . bounds l -= ( pad / 2.0 ) b -= ( pad / 2.0 ) w += pad h += pad r = Rectangle ( xy = ( l , b ) , width = w , height = h , fill = fill ) r . set_transform ( transforms . IdentityTransform ( ) ) r . set_clip_on ( False ) r . update ( props ) r . draw ( renderer )
this is a debug function to draw a rectangle around the bounding box returned by :meth:~matplotlib .