class Gnuplot::Multiplot

Constants

NEGATIVE_BOOLEANS
VERSION

Public Class Methods

new(gnuplot, opts={}, &block) click to toggle source
# File lib/gnuplot/multiplot.rb, line 26
def initialize(gnuplot, opts={}, &block)
  string = 
    if opts.is_a?(Hash)
      opts.map {|key, val|
        if NEGATIVE_BOOLEANS.has_key?(key)
          val ? key : NEGATIVE_BOOLEANS[key]
        else
          pair = 
            if val.is_a?(Array)
              [key, val.join(", ")]
            elsif key == :title
              [key, "\"#{val}\""]
            else
              [key, val]
            end
          pair.join(" ")
        end
      }.join(" ")
    else
      opts
    end
  gnuplot << "set multiplot " << string << "\n"
  block.call(gnuplot)
  gnuplot << "unset multiplot\n"
end