This notebook describes the plots you can make with Gruff in Daru.

In [1]:
require 'daru'
Out[1]:
true

Lets change the plotting library to Gruff.

In [2]:
Daru.plotting_library = :gruff
Out[2]:
:gruff

Plotting Vector

In [5]:
dv = Daru::Vector.new [1, 2, 3]
Out[5]:
Daru::Vector(3)
0 1
1 2
2 3

Bar Graph

In [6]:
dv.plot do |p|
  p.title = 'lol'
end
Out[6]:

Pie Chart

In [7]:
dv.plot type: :pie
Out[7]:

Line Graph

In [8]:
dv.plot type: :line
Out[8]:

Scatter Plot

In [9]:
dv.plot type: :scatter
Out[9]:

Plotting Category Vector

Bar Graph

In [11]:
dv = Daru::Vector.new [:a, :a, :a, :b, :b, :b, :c, :c], type: :category
Out[11]:
Daru::Vector(8)
0 a
1 a
2 a
3 b
4 b
5 b
6 c
7 c
In [12]:
dv.plot
Out[12]:
In [13]:
dv.plot type: :bar, method: :fraction
Out[13]:

Pie Chart

In [14]:
dv.plot type: :pie do |p|
  p.title = 'category plot'
end
Out[14]:
In [ ]: