Method: #genericplot

Defined in:
lib/svmlab-plot.rb

#genericplot(plotdata, file, title = 'Plot', xtitle = 'X', ytitle = 'Y') ⇒ Object

Each should be an array giving more than one plot



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/svmlab-plot.rb', line 8

def genericplot(plotdata, file, title='Plot', xtitle='X', ytitle='Y')
  Gnuplot.open do |gp| # This could be either a file or the gnuplot process that we pipe to
    Gnuplot::Plot.new( gp ) do |plot|
      plot.title  title
      plot.xlabel xtitle
      plot.ylabel ytitle
      plot.set "grid"
      if file =~ /(png)|(ps)$/
        # Remember to add following line to your .baschrc file :
        # export GDFONTPATH=/usr/share/fonts/truetype/ttf-bitstream-vera/
        plot.terminal "png size 800,600 font Vera 16" if file =~ /png$/
        #plot.terminal "png size 800,600 large" if file =~ /png$/
        plot.terminal "postscript color \"Helvetica\" 16" if file =~ /ps$/          
        plot.output file
      end
      plot.data = plotdata
    end
  end
end