class GraphKit::GnuplotSetOptions
Constants
- GNUPLOT_SETS
- QUOTED
Attributes
multiplot_following[RW]
Public Instance Methods
[]=(opt, val)
click to toggle source
Calls superclass method
# File lib/graphkit/gnuplot.rb, line 145 def []=(opt, val) raise "#{opt} is not a valid gnuplot set option" unless GNUPLOT_SETS.include? opt super end
apply(io)
click to toggle source
# File lib/graphkit/gnuplot.rb, line 150 def apply(io) io << "set term #{GNUPLOT_DEFAULT_TERM}\n" unless self[:term] or self.multiplot_following self.each do |var,val| next unless val next if self.multiplot_following and ["term", "output"].include? var.to_s next if var.to_s == "multiplot" apply_option(io, var, val) end apply_option(io, :multiplot, self[:multiplot]) if self[:multiplot] end
apply_option(io, var, val)
click to toggle source
# File lib/graphkit/gnuplot.rb, line 161 def apply_option(io, var, val) if val == "unset" #eputs "Unsetting #{var}" io << "unset #{var}\n" return end if var.to_s == 'log_axis' var = 'log' end if val.kind_of? Array val.each do |vall| io << "set #{var} #{vall}\n" end elsif QUOTED.include? var.to_s and not val =~ /^\s*'.*'/ #ep "quoting #{var}: #{val}" io << "set #{var} '#{val}'\n" else io << "set #{var} #{val}\n" end end