def plot(path = nil, **options)
      options[:output] ||= path
      plot_options = mix_options(options) do |plot_opts, anim_opts|
        plot_opts.merge(term: ['gif', anim_opts])
      end.to_h
      need_output = plot_options[:output].nil?
      plot_options[:output] = Dir::Tmpname.make_tmpname('anim', 0) if need_output
      terminal = Terminal.new
      multiplot(terminal, plot_options)
      # guaranteed wait for plotting to finish
      terminal.close
      if need_output
        result = File.binread(plot_options[:output])
        File.delete(plot_options[:output])
      else
        result = nil
      end
      result
    end
def plot(path = nil, **options)
      options[:output] ||= path
      plot_options = mix_options(options) do |plot_opts, anim_opts|
        plot_opts.merge(term: ['gif', anim_opts])
      end.to_h
      need_output = plot_options[:output].nil?
      plot_options[:output] = Dir::Tmpname.make_tmpname('anim', 0) if need_output
      terminal = Terminal.new
      multiplot(terminal, plot_options)
      # guaranteed wait for plotting to finish
      terminal.close
      if need_output
        result = File.binread(plot_options[:output])
        File.delete(plot_options[:output])
      else
        result = nil
      end
      result
    end
This method creates a gif animation where frames are plots
 already contained by Animation object.

 Options passed in #plot have priority over those which were set before.

 Inner options of Plots have the highest priority (except
 :term and :output which are ignored).

 @param path [String] path to new gif file that will be created as a result
 @param options [Hash] see note about available options in top class documentation
 @return [nil] if path to output file given
 @return [String] gif file contents if no path to output file given