Module: IRuby

Defined in:
lib/rbbt/util/iruby.rb

Class Method Summary collapse

Class Method Details

.ggplotObject



16
17
18
19
# File 'lib/rbbt/util/iruby.rb', line 16

def self.ggplot(...)
  svg = R::SVG.ggplot(...)
  IRuby.html(svg)
end

.img(file) ⇒ Object



5
6
7
# File 'lib/rbbt/util/iruby.rb', line 5

def self.img(file)
  IRuby.html("<img src='#{file}'/>")
end

.plotObject



9
10
11
12
13
14
# File 'lib/rbbt/util/iruby.rb', line 9

def self.plot(...)
  filename = Rbbt.iruby[rand(10000).to_s + ".png"]
  Open.mkdir File.dirname(filename)
  R::PNG.plot(filename, ...)
  img(filename)
end