Class: Perfer::RGrapher
- Inherits:
-
Object
- Object
- Perfer::RGrapher
- Defined in:
- lib/perfer/grapher/r_grapher.rb
Instance Attribute Summary collapse
-
#r ⇒ Object
readonly
Returns the value of attribute r.
Instance Method Summary collapse
- #boxplot(results) ⇒ Object
-
#initialize ⇒ RGrapher
constructor
A new instance of RGrapher.
Constructor Details
#initialize ⇒ RGrapher
Returns a new instance of RGrapher.
4 5 6 7 |
# File 'lib/perfer/grapher/r_grapher.rb', line 4 def initialize require 'rinruby' @r = RinRuby.new(false, false) end |
Instance Attribute Details
#r ⇒ Object (readonly)
Returns the value of attribute r.
3 4 5 |
# File 'lib/perfer/grapher/r_grapher.rb', line 3 def r @r end |
Instance Method Details
#boxplot(results) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/perfer/grapher/r_grapher.rb', line 9 def boxplot(results) data = results.map { |result| result.data.map { |m| m[:real]/result[:iterations] } } data.each_with_index { |d,i| r.assign("data#{i}", d) } r.data_rownames = results.map { |result| Formatter.short_ruby_description(result[:ruby]) } r.main_title = "#{results.first[:session]} : #{results.first[:job]}" r.eval <<-EOR pdf("graph.pdf", paper="a4", height=12) data = list(#{data.size.times.map { |i| "data#{i}" } * ',' }) names(data) = data_rownames par(mar=c(20,4,4,2), las=2, cex.axis=.8) boxplot(data, main=main_title) EOR end |