Sha256: ded3adb2d54a9a5daba9296fc4bafbe5ea531f57cb0e4b07dc6be7e349e2e8a7

Contents?: true

Size: 677 Bytes

Versions: 16

Compression:

Stored size: 677 Bytes

Contents

#!/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

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
rb-gsl-1.16.0.4 examples/vector/gnuplot.rb
rb-gsl-1.16.0.3 examples/vector/gnuplot.rb
rb-gsl-1.16.0.3.rc1 examples/vector/gnuplot.rb
gsl-nmatrix-1.15.3.2 examples/vector/gnuplot.rb
gsl-nmatrix-1.15.3.1 examples/vector/gnuplot.rb
rb-gsl-1.16.0.2 examples/vector/gnuplot.rb
rb-gsl-1.16.0.1 examples/vector/gnuplot.rb
rb-gsl-1.16.0 examples/vector/gnuplot.rb
rb-gsl-1.15.3.2 examples/vector/gnuplot.rb
rb-gsl-1.15.3.1 examples/vector/gnuplot.rb
blackwinter-gsl-1.15.3.2 examples/vector/gnuplot.rb
gsl-nmatrix-1.15.3.0 examples/vector/gnuplot.rb
gsl-1.15.3 examples/vector/gnuplot.rb
gsl-1.14.7 examples/vector/gnuplot.rb
gsl-1.14.6 examples/vector/gnuplot.rb
gsl-1.14.5 examples/vector/gnuplot.rb