lib/gnuplotrb/plot.rb
##
# Output plot to term (if given) or to this plot's own terminal.
#
# @param term [Terminal] Terminal object to plot to
# @param :multiplot_part [Boolean] true if this plot is part of a multiplot. For inner use!
# @param options [Hash] see options in Plot top level doc.
#   Options passed here have priority over already existing.
# @return [Plot] self
Output plot to term (if given) or to this plot's own terminal.
Output plot to term ( if given ) or to this plot ' s own terminal .
def plot(term = nil, multiplot_part: false, **options)
      fail ArgumentError, 'Empty plots are not supported!' if @datasets.empty?
      inner_opts = if multiplot_part
                     @options.merge(options).reject { |key, _| [:term, :output].include?(key) }
                   else
                     @options.merge(options)
                   end
      terminal = term || (inner_opts[:output] ? Terminal.new : own_terminal)
      ds_string = @datasets.map { |dataset| dataset.to_s(terminal) }.join(' , ')
      full_command = @cmd + ds_string
      terminal.set(inner_opts).stream_puts(full_command).unset(inner_opts.keys)
      if inner_opts[:output]
        terminal.close unless term
        sleep 0.01 until File.size?(inner_opts[:output])
      end
      self
    end
def plot ( term = nil , multiplot_part : false , ** options ) fail ArgumentError , 'Empty plots are not supported!' if @datasets . empty? inner_opts = if multiplot_part @options . merge ( options ) . reject { | key , _ | [ :term , :output ] . include? ( key ) } else @options . merge ( options ) end terminal = term || ( inner_opts [ :output ] ? Terminal . new : own_terminal ) ds_string = @datasets . map { | dataset | dataset . to_s ( terminal ) } . join ( ' , ' ) full_command = @cmd + ds_string terminal . set ( inner_opts ) . stream_puts ( full_command ) . unset ( inner_opts . keys ) if inner_opts [ :output ] terminal . close unless term sleep 0.01 until File . size? ( inner_opts [ :output ] ) end self end
Output plot to term (if given) or to this plot's own terminal.
Output plot to term ( if given ) or to this plot ' s own terminal .
# guaranteed wait for plotting to finish # not guaranteed wait for plotting to finish # work bad with terminals like svg and html
None
Plot
term
Terminal object to plot to
Terminal object to plot to
multiplot_part
<not_specific>
options
see options in Plot top level doc. Options passed here have priority over already existing.
see options in Plot top level doc . Options passed here have priority over already existing .
:multiplot_part
<not_specific>
true if this plot is part of a multiplot. For inner use!
true if this plot is part of a multiplot . For inner use!