/usr/lib/ruby/1.8/gsl/gnuplot.rb is in libgsl-ruby1.8 1.14.3-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | require("gnuplot")
class Array
def to_gplot
if ( self[0].kind_of? Array ) then
tmp = self[0].zip( *self[1..-1] )
tmp.collect { |a| a.join(" ") }.join("\n") + "\ne"
elsif ( self[0].kind_of? Numeric ) then
s = ""
self.length.times { |i| s << "#{self[i]}\n" }
s
elsif ( self[0].kind_of? GSL::Vector ) then
tmp = self[0].zip( *self[1..-1] )
tmp.collect { |a| a.join(" ") }.join("\n") + "\ne"
else
self[0].zip( *self[1..-1] ).to_gplot
end
end
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
elsif ( self[0].kind_of? Numeric ) then
self.length.times do |i| f << "#{self[i]}\n" end
else
self[0].zip( *self[1..-1] ).to_gsplot
end
f
end
end
|