Module: Daru::Plotting::Vector::GruffLibrary

Defined in:
lib/daru/plotting/gruff/vector.rb

Instance Method Summary collapse

Instance Method Details

#plot(opts = {}) {|plot| ... } ⇒ Object

Yields:



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/daru/plotting/gruff/vector.rb', line 5

def plot opts={}
  type = opts[:type] || :bar
  size = opts[:size] || 500
  case type
  when :line, :bar, :pie, :scatter, :sidebar
    plot = send("#{type}_plot", size)
  # TODO: hist, box
  # It turns out hist and box are not supported in Gruff yet
  else
    raise ArgumentError, 'This type of plot is not supported.'
  end
  yield plot if block_given?
  plot
end