Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/gnuplot.rb
Instance Method Summary collapse
Instance Method Details
#to_gplot ⇒ Object
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/gnuplot.rb', line 192 def to_gplot if ( self[0].kind_of? Array ) then tmp = self[0].zip( *self[1..-1] ) tmp.collect { |a| a.join(" ") }.join("\n") + "\n" else s = "" self.length.times { |i| s << "#{self[i]}\n" } s end end |
#to_gsplot ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/gnuplot.rb', line 203 def to_gsplot f = "" if ( self[0].kind_of? Array ) then x = self[0] y = self[1] d = self[2] x.each_with_index do |xv, i| y.each_with_index do |yv, j| f << [ xv, yv, d[i][j] ].join(" ") << "\n" end # f << "\n" end else self.length.times do |i| f << "#{self[i]}\n" end end f end |