In [1]:
require 'daru/view'
Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.

Install the mechanize gem version ~>2.7.5 for using mechanize functions.
Out[1]:
true
In [2]:
df =     Daru::DataFrame.new(
      {
        a: [1, 2, 3, 4, 5, 6],
        b: [1, 5, 2, 5, 1, 0],
        c: [1, 6, 7, 2, 6, 0]
      }, index: 'a'..'f'
    )
Out[2]:
Daru::DataFrame(6x3)
a b c
a 1 1 1
b 2 5 6
c 3 2 7
d 4 5 2
e 5 1 6
f 6 0 0
In [3]:
plt = Daru::View::Plot.new(df, type: :line, x: :a, y: :c)
Out[3]:
#<Daru::View::Plot:0x007f8af499c998 @data=#<Daru::DataFrame(6x3)>
       a   b   c
   a   1   1   1
   b   2   5   6
   c   3   2   7
   d   4   5   2
   e   5   1   6
   f   6   0   0, @options={:type=>:line, :x=>:a, :y=>:c}, @adapter=Daru::View::Adapter::NyaplotAdapter, @chart=#<Nyaplot::Plot:0x007f8af499c650 @properties={:diagrams=>[#<Nyaplot::Diagram:0x007f8af4987750 @properties={:type=>:line, :options=>{:x=>:a, :y=>:c}, :data=>"a3543f81-f8a5-4b47-ad01-4b67fca08ad2"}, @xrange=[1, 6], @yrange=[0, 7]>], :options=>{}}>>
In [4]:
plt.show_in_iruby
In [5]:
Daru::View.plotting_library = :nyaplot
Out[5]:
:nyaplot
In [6]:
plt2 = Daru::View::Plot.new(df)
Out[6]:
#<Daru::View::Plot:0x007f8af48c66e0 @data=#<Daru::DataFrame(6x3)>
       a   b   c
   a   1   1   1
   b   2   5   6
   c   3   2   7
   d   4   5   2
   e   5   1   6
   f   6   0   0, @options={}, @adapter=Daru::View::Adapter::NyaplotAdapter, @chart=#<Nyaplot::Plot:0x007f8af48c65f0 @properties={:diagrams=>[], :options=>{}}>>
In [7]:
plt2.show_in_iruby
In [8]:
dv = Daru::Vector.new [1, 2, 3]
Out[8]:
Daru::Vector(3)
0 1
1 2
2 3
In [10]:
plt3 = Daru::View::Plot.new(dv)
Out[10]:
#<Daru::View::Plot:0x007f8af42ac980 @data=#<Daru::Vector(3)>
   0   1
   1   2
   2   3, @options={}, @adapter=Daru::View::Adapter::NyaplotAdapter, @chart=#<Nyaplot::Plot:0x007f8af42ac778 @properties={:diagrams=>[#<Nyaplot::Diagram:0x007f8af42a61e8 @properties={:type=>:scatter, :options=>{:x=>"data0", :y=>"data1"}, :data=>"c7cc03ef-6209-4ed4-97ec-23826905f930"}, @xrange=[0, 2], @yrange=[1, 3]>], :options=>{}}>>
In [11]:
plt3.show_in_iruby
In [15]:
plt3 = Daru::View::Plot.new(dv, type: :line)
Out[15]:
#<Daru::View::Plot:0x007f8af52d25a8 @data=#<Daru::Vector(3)>
   0   1
   1   2
   2   3, @options={:type=>:line}, @adapter=Daru::View::Adapter::NyaplotAdapter, @chart=#<Nyaplot::Plot:0x007f8af52d2418 @properties={:diagrams=>[#<Nyaplot::Diagram:0x007f8af52d1158 @properties={:type=>:line, :options=>{:x=>"data0", :y=>"data1"}, :data=>"8a647dc7-e7c4-4f30-b573-aeedeacefc2d"}, @xrange=[0, 2], @yrange=[1, 3]>], :options=>{}}>>
In [16]:
plt3.show_in_iruby