-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rdatasets.rb
44 lines (37 loc) · 923 Bytes
/
rdatasets.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
# RDatasets
# https://github.com/kojix2/rdatasets
require 'rdatasets'
require 'gr/plot'
passenger = RDatasets.datasets.AirPassengers
time = passenger.at(0).to_a
value = passenger.at(1).to_a
opts = { title: 'Air Passenger numbers from 1949 to 1961',
ylabel: "Passenger numbers (1000's)",
xlabel: 'Date' }
GR.plot(time, value, opts)
sleep 1.5
GR.step(time, value, opts)
sleep 1.5
GR.stem(time, value, opts)
sleep 1.5
GR.barplot(time, value, opts)
sleep 1.5
volcano = RDatasets.datasets.volcano.to_matrix.to_a.transpose
# Fixme
volcano = Numo::DFloat.cast(volcano)
opts = { title: "Auckland's Maunga Whau Volcano" }
GR.contour(volcano, opts)
sleep 1.5
GR.tricont(volcano, opts)
sleep 1.5
GR.contourf(volcano, opts)
sleep 1.5
GR.heatmap(volcano, opts)
sleep 1.5
GR.surface(volcano, opts)
sleep 1.5
GR.trisurf(volcano, opts)
sleep 1.5
GR.wireframe(volcano, opts)
sleep 1.5