code: def add_plot(self, *args, extension='pdf', **kwargs):
          
  
          add_image_kwargs = {}
  
          for key in ('width', 'placement'):
              if key in kwargs:
                  add_image_kwargs[key] = kwargs.pop(key)
  
          filename = self._save_plot(*args, extension=extension, **kwargs)
  
          self.add_image(filename, **add_image_kwargs)
docs: Add the current Matplotlib plot to the figure.
  
          The plot that gets added is the one that would normally be shown when
          using ``plt.show()``.
  
          Args
          ----
          args:
              Arguments passed to plt.savefig for displaying the plot.
          extension : str
              extension of image file indicating figure file type
          kwargs:
              Keyword arguments passed to plt.savefig for displaying the plot. In
              case these contain ``width`` or ``placement``, they will be used
              for the same purpose as in the add_image command. Namely the width
              and placement of the generated plot in the LaTeX document.