class_docstr: Execute the file and store the output, docstring, and
  sequence of matplotlib figures
docstr: Execute the file, catching standard output
  and matplotlib figures
code: def execute_file(self):
      """Execute the file, catching standard output
      and matplotlib figures
      """
      dirname, fname = os.path.split(self.filename)
      print("plotting %s" % fname)
  
      # close any currently open figures
      plt.close("all")
  
      # change to file directory for execution
      cwd = os.getcwd()
  
      try:
          if dirname:
              os.chdir(dirname)
  
          # set stdout to self in order to catch output (with write method)
          sys.stdout = self
  
          # execute the file
          with open(os.path.basename(self.filename)) as f:
              code = compile(f.read(), "somefile.py", "exec")
              exec(code, {"pl": plt, "plt": plt, "pylab": plt})
  
          fig_mgr_list = (
              matplotlib._pylab_helpers.Gcf.get_all_fig_managers()
          )
          self.figlist = [
              manager.canvas.figure for manager in fig_mgr_list
          ]
  
          self.figlist = sorted(
              self.figlist, key=lambda fig: fig.number
          )
  
      except:
          print(80 * "_")
          print("%s is not compiling:" % fname)
          traceback.print_exc()
          print(80 * "_")
      finally:
          # change back to original directory, and reset sys.stdout
          sys.stdout = self.stdout
          os.chdir(cwd)
          ncol = gc.collect()
          if self.print_output and (ncol > 0):
              print("\n > collected %i unreachable objects" % ncol)
  
imports: import sys
  import os
  import traceback
  import token
  import tokenize
  import gc
  import shutil
  import glob
  import warnings
  import matplotlib
  from matplotlib import image
  from matplotlib import pyplot
label_desc: Use image node_id 6 for calling the ExecFile obj's underlying member method code with example usage: obj.execute_file() without return types