(self, ax, **kwargs)
return annotation
Draws the annotation box for the given axis *ax*. Additional kwargs
        are passed on to ``annotate``.
Draws the annotation box for the given axis *ax*. Additional kwargs
        are passed on to ``annotate``.
Draws the annotation box for the given axis * ax * . Additional kwargs are passed on to annotate .
def annotate(self, ax, **kwargs):
        """
        Draws the annotation box for the given axis *ax*. Additional kwargs
        are passed on to ``annotate``.
        """
        def update_from_defaults(key, kwargs):
            if kwargs.get(key, None) is not None:
                new = copy.deepcopy(self.default_annotation_kwargs[key])
                new.update(kwargs[key])
                kwargs[key] = new
            return kwargs


        # Ensure bbox and arrowstyle params passed in use the defaults for
        # DataCursor. This allows things like ``bbox=dict(alpha=1)`` to show a
        # yellow, rounded box, instead of the mpl default blue, square box.)
        kwargs = update_from_defaults('bbox', kwargs)
        kwargs = update_from_defaults('arrowstyle', kwargs)

        # Set defaults where approriate.
        for key in self.default_annotation_kwargs:
            if key not in kwargs:
                kwargs[key] = self.default_annotation_kwargs[key]

        annotation = ax.annotate('This text will be reset', **kwargs)
        annotation._has_been_shown = False

        # Place the annotation in the figure instead of the axes so that it
        # doesn't get hidden behind other subplots (zorder won't fix that).
        ax.figure.texts.append(ax.texts.pop())

        # Create a draggable annotation box, if required.
        if self.draggable:
            offsetbox.DraggableAnnotation(annotation)

        # Save whether or not alignment is user-specified. If not, adjust to
        # match text offset (and update when display moves out of figure).
        self._user_set_ha = 'ha' in kwargs or 'horizontalalignment' in kwargs
        self._user_set_va = 'va' in kwargs or 'verticalalignment' in kwargs
        self._adjust_alignment(annotation)

        return annotation
def annotate ( self , ax , * * kwargs ) : def update_from_defaults ( key , kwargs ) : if kwargs . get ( key , None ) is not None : new = copy . deepcopy ( self . default_annotation_kwargs [ key ] ) new . update ( kwargs [ key ] ) kwargs [ key ] = new return kwargs # Ensure bbox and arrowstyle params passed in use the defaults for # DataCursor. This allows things like ``bbox=dict(alpha=1)`` to show a # yellow, rounded box, instead of the mpl default blue, square box.) kwargs = update_from_defaults ( 'bbox' , kwargs ) kwargs = update_from_defaults ( 'arrowstyle' , kwargs ) # Set defaults where approriate. for key in self . default_annotation_kwargs : if key not in kwargs : kwargs [ key ] = self . default_annotation_kwargs [ key ] annotation = ax . annotate ( 'This text will be reset' , * * kwargs ) annotation . _has_been_shown = False # Place the annotation in the figure instead of the axes so that it # doesn't get hidden behind other subplots (zorder won't fix that). ax . figure . texts . append ( ax . texts . pop ( ) ) # Create a draggable annotation box, if required. if self . draggable : offsetbox . DraggableAnnotation ( annotation ) # Save whether or not alignment is user-specified. If not, adjust to # match text offset (and update when display moves out of figure). self . _user_set_ha = 'ha' in kwargs or 'horizontalalignment' in kwargs self . _user_set_va = 'va' in kwargs or 'verticalalignment' in kwargs self . _adjust_alignment ( annotation ) return annotation