Module: Simpler::Plot

Included in:
Simpler
Defined in:
lib/simpler/plot.rb

Instance Method Summary collapse

Instance Method Details

#plot(file_w_extension, opts = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/simpler/plot.rb', line 5

def plot(file_w_extension, opts={}, &block)
  device = self.class.filename_to_plottype(file_w_extension)
  opts_as_ropts = opts.map {|k,v| "#{k}=#{r_format(v)}"}
  string = "#{device}(#{file_w_extension.inspect}, #{opts_as_ropts.join(', ')})\n"
  string << block.call << "\n"
  string << "dev.off()\n"
  string
end