lib/matplotlib/text.py
def update_bbox_position_size(self, renderer):
        """
        Update the location and the size of the bbox. This method
        should be used when the position and size of the bbox needs to
        be updated before actually drawing the bbox.
        """

        # For arrow_patch, use textbox as patchA by default.

        if not isinstance(self.arrow_patch, FancyArrowPatch):
            return

        if self._bbox_patch:

            trans = self.get_transform()

            # don't use self.get_position here, which refers to text position
            # in Text, and dash position in TextWithDash:
            posx = float(self.convert_xunits(self._x))
            posy = float(self.convert_yunits(self._y))

            posx, posy = trans.transform_point((posx, posy))

            x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
            self._bbox_patch.set_bounds(0., 0.,
                                        w_box, h_box)
            theta = self.get_rotation()/180.*math.pi
            tr = mtransforms.Affine2D().rotate(theta)
            tr = tr.translate(posx+x_box, posy+y_box)
            self._bbox_patch.set_transform(tr)
            fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
            self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
            #self._bbox_patch.draw(renderer)

        else:
            props = self._bbox
            if props is None: props = {}
            props = props.copy() # don't want to alter the pad externally
            pad = props.pop('pad', 4)
            pad = renderer.points_to_pixels(pad)
            if self.get_text() == "":
                self.arrow_patch.set_patchA(None)
                return

            bbox = self.get_window_extent(renderer)
            l,b,w,h = bbox.bounds
            l-=pad/2.
            b-=pad/2.
            w+=pad
            h+=pad
            r = Rectangle(xy=(l,b),
                          width=w,
                          height=h,
                          )
            r.set_transform(mtransforms.IdentityTransform())
            r.set_clip_on( False )
            r.update(props)

            self.arrow_patch.set_patchA(r)

        Update the location and the size of the bbox. This method
        should be used when the position and size of the bbox needs to
        be updated before actually drawing the bbox.
        
Update the location and the size of the bbox. This method
should be used when the position and size of the bbox needs to
be updated before actually drawing the bbox.
Update the location and the size of the bbox . This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox .
def update_bbox_position_size(self, renderer):
        if not isinstance(self.arrow_patch, FancyArrowPatch):
            return
        if self._bbox_patch:
            trans = self.get_transform()
            posx = float(self.convert_xunits(self._x))
            posy = float(self.convert_yunits(self._y))
            posx, posy = trans.transform_point((posx, posy))
            x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
            self._bbox_patch.set_bounds(0., 0.,
                                        w_box, h_box)
            theta = self.get_rotation()/180.*math.pi
            tr = mtransforms.Affine2D().rotate(theta)
            tr = tr.translate(posx+x_box, posy+y_box)
            self._bbox_patch.set_transform(tr)
            fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
            self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
        else:
            props = self._bbox
            if props is None: props = {}
            props = props.copy() 
            pad = props.pop('pad', 4)
            pad = renderer.points_to_pixels(pad)
            if self.get_text() == "":
                self.arrow_patch.set_patchA(None)
                return
            bbox = self.get_window_extent(renderer)
            l,b,w,h = bbox.bounds
            l-=pad/2.
            b-=pad/2.
            w+=pad
            h+=pad
            r = Rectangle(xy=(l,b),
                          width=w,
                          height=h,
                          )
            r.set_transform(mtransforms.IdentityTransform())
            r.set_clip_on( False )
            r.update(props)
            self.arrow_patch.set_patchA(r)
def update_bbox_position_size ( self , renderer ) : if not isinstance ( self . arrow_patch , FancyArrowPatch ) : return if self . _bbox_patch : trans = self . get_transform ( ) posx = float ( self . convert_xunits ( self . _x ) ) posy = float ( self . convert_yunits ( self . _y ) ) posx , posy = trans . transform_point ( ( posx , posy ) ) x_box , y_box , w_box , h_box = _get_textbox ( self , renderer ) self . _bbox_patch . set_bounds ( 0. , 0. , w_box , h_box ) theta = self . get_rotation ( ) / 180. * math . pi tr = mtransforms . Affine2D ( ) . rotate ( theta ) tr = tr . translate ( posx + x_box , posy + y_box ) self . _bbox_patch . set_transform ( tr ) fontsize_in_pixel = renderer . points_to_pixels ( self . get_size ( ) ) self . _bbox_patch . set_mutation_scale ( fontsize_in_pixel ) else : props = self . _bbox if props is None : props = { } props = props . copy ( ) pad = props . pop ( 'pad' , 4 ) pad = renderer . points_to_pixels ( pad ) if self . get_text ( ) == "" : self . arrow_patch . set_patchA ( None ) return bbox = self . get_window_extent ( renderer ) l , b , w , h = bbox . bounds l -= pad / 2. b -= pad / 2. w += pad h += pad r = Rectangle ( xy = ( l , b ) , width = w , height = h , ) r . set_transform ( mtransforms . IdentityTransform ( ) ) r . set_clip_on ( False ) r . update ( props ) self . arrow_patch . set_patchA ( r )
Update the location and the size of the bbox.
Update the location and the size of the bbox .
"""
        Update the location and the size of the bbox. This method
        should be used when the position and size of the bbox needs to
        be updated before actually drawing the bbox.
        """ # For arrow_patch, use textbox as patchA by default. # don't use self.get_position here, which refers to text position # in Text, and dash position in TextWithDash: #self._bbox_patch.draw(renderer) # don't want to alter the pad externally
self
renderer