Class: Daru::Vector

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

Overview

Methods to take data for GnuplotRB plots.

Instance Method Summary collapse

Instance Method Details

#to_gnuplot_pointsString

Convert Vector to Gnuplot format.

Returns:

  • (String)

    data converted to Gnuplot format



32
33
34
35
36
37
38
39
40
# File 'lib/gnuplotrb/external_classes/daru.rb', line 32

def to_gnuplot_points
  result = ''
  each_with_index do |value, index|
    quoted = (index.is_a?(String) || index.is_a?(Symbol)) && index.length > 0
    result += quoted ? "\"#{index}\" " : "#{index} "
    result += "#{value}\n"
  end
  result
end