Class: Gnuplot::Multiplot
- Inherits:
-
Object
- Object
- Gnuplot::Multiplot
- Defined in:
- lib/gnuplot/multiplot.rb,
lib/gnuplot/multiplot/version.rb
Constant Summary collapse
- NEGATIVE_BOOLEANS =
{ enhanced: :noenhanced, rowsfirst: :columnsfirst, downwards: :upwards, }
- VERSION =
"0.0.1"
Instance Method Summary collapse
-
#initialize(gnuplot, opts = {}, &block) ⇒ Multiplot
constructor
A new instance of Multiplot.
Constructor Details
#initialize(gnuplot, opts = {}, &block) ⇒ Multiplot
Returns a new instance of Multiplot.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 |