Creating a scatterplot with statsample's Statsample::Graph::Scatterplot class.
In this example we'll demonstrate how a normally distributed Daru::Vector can be created using the daru and distribution gems, and how the values generated can be plotted very easily using the 'scatterplot' shorthand and supplying X and Y co-ordinates.
Statsample uses rubyvis internally for generating plots.
In [1]:
require 'statsample'
include Statsample::Shorthand
n = 100
x = rnorm(n)
y = x + rnorm(n,0.5,0.2)
Statsample::Graph::Scatterplot.new(x,y)
Out[1]:
In [ ]: