Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/gnuplotrb/external_classes/array.rb

Overview

Methods to take data for GnuplotRB plots.

Instance Method Summary collapse

Instance Method Details

#to_gnuplot_pointsString

taken for example from current gnuplot bindings


6
7
8
9
10
11
12
13
14
15
16
# 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