Method: Statsample::Graph::Boxplot#initialize

Defined in:
lib/statsample/graph/boxplot.rb

#initialize(opts = Hash.new) ⇒ Boxplot

Create a new Boxplot. Parameters: Hash of options

  • :vectors: Array of vectors

  • :groups: Array of same size as :vectors:, with name of groups

    to colorize vectors
    

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/statsample/graph/boxplot.rb', line 58

def initialize(opts=Hash.new)
  @vectors=opts.delete :vectors
  raise "You should define vectors" if @vectors.nil?
  
  opts_default={
    :name=>_("Boxplot"),
    :groups=>nil,
    :width=>400,
    :height=>300,
    :margin_top=>10,
    :margin_bottom=>20,
    :margin_left=>20,
    :margin_right=>20,
    :minimum=>nil,
    :maximum=>nil,
    :label_angle=>0
  }
  @opts=opts_default.merge(opts)
  opts_default.keys.each {|k| send("#{k}=", @opts[k]) }
end