In [1]:
require 'mikon'
Out[1]:
Out[1]:
true
In [3]:
x = (1..100).to_a
Out[3]:
[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, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
In [5]:
y = 100.times.map{|e| rand(e)}
Out[5]:
[0.11586688829185865, 0, 1, 2, 3, 0, 2, 6, 1, 0, 4, 3, 10, 10, 4, 8, 8, 8, 8, 12, 10, 9, 2, 22, 21, 16, 23, 7, 13, 2, 17, 7, 25, 2, 7, 34, 17, 34, 18, 17, 20, 30, 39, 32, 4, 0, 26, 18, 35, 36, 2, 41, 44, 7, 13, 38, 7, 2, 28, 54, 4, 50, 12, 44, 10, 53, 9, 32, 36, 64, 6, 12, 8, 62, 54, 22, 53, 38, 72, 15, 37, 13, 69, 7, 75, 5, 62, 21, 18, 31, 82, 74, 79, 39, 60, 49, 10, 82, 94, 87]
In [7]:
df = Mikon::DataFrame.new({x: x, y: y})
Out[7]:
xy
010.11586688829185865
120.0
231.0
342.0
453.0
560.0
672.0
786.0
891.0
9100.0
10114.0
11123.0
121310.0
131410.0
14154.0
15168.0
16178.0
17188.0
18198.0
192012.0
202110.0
21229.0
22232.0
232422.0
242521.0
252616.0
262723.0
27287.0
282913.0
29302.0
303117.0
31327.0
323325.0
33342.0
34357.0
353634.0
363717.0
373834.0
383918.0
394017.0
404120.0
414230.0
424339.0
434432.0
44454.0
45460.0
464726.0
474818.0
484935.0
495036.0
50512.0
.........
9910087.0
In [12]:
plot = Nyaplot::Plot.new
sc = plot.add_with_df(df, :scatter, :x, :y)
plot.show
Out[12]:
In [ ]: