In [1]:
require "rubygems"
gem "nyaplot", "0.2.0.rc1"
Out[1]:
In [2]:
$DEBUG_NYAPLOT = true
Out[2]:
In [3]:
require 'nyaplot'
include Nyaplot
Out[3]:
Out[3]:
In [4]:
p1 = Plot.add(:scatter, x: [1,2,3], y: [3,-2, 4])
Out[4]:
In [5]:
samples = Array.new(10).map.with_index{|d,i| 'cat'+i.to_s}
x=[];y=[];home=[]
10.times do
x.push(5*rand)
y.push(5*rand)
end
df = Nyaplot::DataFrame.new({x:x,y:y,name:samples})
df
Out[5]:
In [6]:
p2 = Plot.from(df).add(:scatter, x: :x, y: :y).shape_by(:name)
Out[6]:
In [7]:
p3 = Plot.from(df).add(:line, x: :x, y: :y).width(1000)
Out[7]:
In [8]:
rows(columns(p1, p2), p3)
Out[8]:
In [ ]: