code: def _plt_handle_figure(plot):
      r
  
      # Preserve documentation of plot.
      @functools.wraps(plot)
  
      def inner(obj, **kwargs):
  
          # Create a figure and an axis if none were passed.
          if kwargs['ax'] is None:
              _, plt, _ = _import_plt()
              fig = plt.figure()
              global _plt_figures
              _plt_figures.append(fig)
  
              if (hasattr(obj, 'coords') and obj.coords.ndim == 2 and
                      obj.coords.shape[1] == 3):
                  kwargs['ax'] = fig.add_subplot(111, projection='3d')
              else:
                  kwargs['ax'] = fig.add_subplot(111)
  
          title = kwargs.pop('title')
  
          plot(obj, **kwargs)
  
          kwargs['ax'].set_title(title)
  
          try:
              fig.show(warn=False)
          except NameError:
              # No figure created, an axis was passed.
              pass
  
          return kwargs['ax'].figure, kwargs['ax']
  
      return inner
docs: r"""Handle the common work (creating an axis if not given, setting the
      title) of all matplotlib plot commands.