This example illustrates how daru, combined with Statsample::Graph::Boxplot can be used for generating box plots of a normally distributed set of data.
The 'rnorm' function, defined in statsample/shorthands generates a Daru::Vector object which contains the specified number of random variables in a normal distribution. It uses the 'distribution' gem for this purpose.
require 'daru'
require 'statsample'
include Statsample::Shorthand
n = 30
a = rnorm(n-1,50,10)
b = rnorm(n, 30,5)
c = rnorm(n,5,1)
# Append 2 to vector 'a' at the end
a.push(2, a.size)
a.class
a.plot
IRuby.svg boxplot(:vectors=>[a,b,c],:width=>300, :height=>300, :groups=>%w{first first second}, :minimum=>0).to_svg
IRuby.svg boxplot(:vectors=>[a,b,c],:width=>300, :height=>300, :groups=>%w{first first second}, :minimum=>0).to_svg