lib/gnuplotrb/animation.rb
##
# 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
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).
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 ) .
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.gnuplot_tmpname('anim') if need_output
      terminal = Terminal.new
      multiplot(terminal, plot_options)
      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 . gnuplot_tmpname ( 'anim' ) if need_output terminal = Terminal . new multiplot ( terminal , plot_options ) 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.
This method creates a gif animation where frames are plots already contained by Animation object .
# guaranteed wait for plotting to finish
if path to output file given
if path to output file given
nil
gif file contents if no path to output file given
gif file contents if no path to output file given
String
path
path to new gif file that will be created as a result
path to new gif file that will be created as a result
options
see note about available options in top class documentation
see note about available options in top class documentation