class Array

Methods to take data for GnuplotRB plots.

Public Instance Methods

to_gnuplot_points() click to toggle source

taken for example from current gnuplot bindings @return [String] array converted to Gnuplot format

# File lib/gnuplotrb/external_classes/array.rb, line 6
def to_gnuplot_points
  return '' if self.empty?
  case self[0]
  when Array
    self[0].zip(*self[1..-1]).map { |a| a.join(' ') }.join("\n")
  when Numeric
    join("\n")
  else
    self[0].zip(*self[1..-1]).to_gnuplot_points
  end
end