code: def datacursor(artists=None, axes=None, **kwargs):
      def plotted_artists(ax):
          artists = (ax.lines + ax.patches + ax.collections
                     + ax.images + ax.containers)
          return artists
      if axes is None:
          managers = pylab_helpers.Gcf.get_all_fig_managers()
          figs = [manager.canvas.figure for manager in managers]
          axes = [ax for fig in figs for ax in fig.axes]
      if not cbook.iterable(axes):
          axes = [axes]
      if artists is None:
          artists = [artist for ax in axes for artist in plotted_artists(ax)]
      return DataCursor(artists, **kwargs)