/usr/share/doc/ruby-gsl/examples/vector/gnuplot.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
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 | #!/usr/bin/env ruby
# Turn on warnings
$-w = true
require 'gnuplot'
require 'gsl'
require 'gsl/gnuplot';
# Plot using gnuplot
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[0:10]"
plot.yrange "[-1.5:1.5]"
plot.title "Sin Wave Example"
plot.xlabel "x"
plot.ylabel "sin(x)"
plot.pointsize 3
plot.grid
x = GSL::Vector[0..10]
y = GSL::Sf::sin(x)
plot.data = [
Gnuplot::DataSet.new( "sin(x)" ) { |ds|
ds.with = "lines"
ds.title = "String function"
ds.linewidth = 4
},
Gnuplot::DataSet.new( [x, y] ) { |ds|
ds.with = "linespoints"
ds.title = "Array data"
}
]
end
end
|