code: def output_figure(array, as_subplot, output_path, output_filename, output_format):
      
      if not as_subplot:
  
          if output_format is 'show':
              plt.show()
          elif output_format is 'png':
              plt.savefig(output_path + output_filename + '.png', bbox_inches='tight')
          elif output_format is 'fits':
              array_util.numpy_array_2d_to_fits(array_2d=array, file_path=output_path + output_filename + '.fits',
                                                overwrite=True)
docs: Output the figure, either as an image on the screen or to the hard-disk as a .png or .fits file.
  
      Parameters
      -----------
      array : ndarray
          The 2D array of image to be output, required for outputting the image as a fits file.
      as_subplot : bool
          Whether the figure is part of subplot, in which case the figure is not output so that the entire subplot can \
          be output instead using the *output_subplot_array* function.
      output_path : str
          The path on the hard-disk where the figure is output.
      output_filename : str
          The filename of the figure that is output.
      output_format : str
          The format the figue is output:
          'show' - display on computer screen.
          'png' - output to hard-disk as a png.
          'fits' - output to hard-disk as a fits file.'