Ruby 'statsample' graph not showing up

52 Views Asked by At

I am trying to use the following code :

require 'statsample'
include Statsample::Shorthand

n = 100
x = rnorm(n)
y = x + rnorm(n,0.5,0.2)
Statsample::Graph::Scatterplot.new(x,y)

I am getting output like this :

#<Statsample::Graph::Scatterplot:0x00000003b7cac0 @v2_name=nil, @v1_name=nil, @v1=#<Daru::Vector(100)>
                   0 -0.8253230853299456
                   1  1.5602776553658153
                   2  1.7155337260438381
                   3  0.9898130381171576
                   4 0.17150928493368836

but no graph as indicated https://github.com/SciRuby/sciruby-notebooks/blob/master/Visualization/Scatterplot%20with%20statsample.ipynb

can someone explain what mistake i am making

1

There are 1 best solutions below

0
On

In the example you are linking to, there is some javascript code that seems to use https://github.com/domitry/Nyaplotjs to plot the graph.

The ruby code is only providing you with coordinate data for the scatter plot, it's not actually drawing something.