Class: Daru::DataFrame

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 DataFrame to Gnuplot format.

Returns:

  • (String)

    data converted to Gnuplot format



13
14
15
16
17
18
19
20
21
22
# File 'lib/gnuplotrb/external_classes/daru.rb', line 13

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