Module: Gnuplot

Defined in:
lib/gnuplot.rb

Defined Under Namespace

Classes: DataSet, Plot, SPlot

Class Method Summary collapse

Class Method Details

.open(persist = true) ⇒ Object

Open a gnuplot process that exists in the current PATH. If the persist flag is true then the -persist flag is added to the command line. The path to the gnuplot executable is determined using the ‘which’ command.

See the gnuplot documentation for information on the persist flag.

todo Add a method to pass the gnuplot path to the function.



18
19
20
21
22
23
24
# File 'lib/gnuplot.rb', line 18

def Gnuplot.open(persist=true)
  cmd = ""
  IO.popen( "which gnuplot" ) { |io| cmd = io.readline.chomp }
  cmd += " -persist" if persist
  
  IO::popen(cmd, "w") { |io| yield io }
end