visualisation-utils 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -11
- data/bin/heat-map +12 -9
- data/bin/scatter-plot +10 -1
- data/visualisation-utils.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -6,6 +6,16 @@ a collection of scripts for standard visualisation tasks
|
|
6
6
|
Installing
|
7
7
|
==========
|
8
8
|
|
9
|
+
`gnuplot` is required for these scripts to work.
|
10
|
+
|
11
|
+
The installation depends on your platform, e.g. for Linux:
|
12
|
+
|
13
|
+
~~~ .bash
|
14
|
+
sudo apt-get install gnuplot
|
15
|
+
~~~
|
16
|
+
|
17
|
+
Then you can install the actual visualisation-utils gem:
|
18
|
+
|
9
19
|
~~~ .bash
|
10
20
|
gem install visualisation-utils
|
11
21
|
~~~
|
@@ -32,13 +42,13 @@ This incantation will bring up the gnuplot gui with the following graph:
|
|
32
42
|
![gui](https://raw.github.com/programmiersportgruppe/visualisation-utils/master/doc/gnuplot-gui.png)
|
33
43
|
|
34
44
|
heat-map
|
35
|
-
|
45
|
+
========
|
36
46
|
|
37
47
|
Prints a heat map visualising the distribution of
|
38
48
|
geo coordinate samples.
|
39
49
|
|
40
50
|
~~~ .bash
|
41
|
-
cat |
|
51
|
+
cat | heat-map <<'END'
|
42
52
|
38.6,-90.5
|
43
53
|
38.6,-90.5
|
44
54
|
40.5,-74.3
|
@@ -59,13 +69,13 @@ This will render to the following visualisation:
|
|
59
69
|
TODO
|
60
70
|
====
|
61
71
|
|
62
|
-
[X] Overriding of autoscale
|
63
|
-
[X] Create nice PNGs
|
64
|
-
[X] Line plots
|
65
|
-
[ ] Changing changing the size of the dots
|
66
|
-
[X] Secondary y-axis
|
67
|
-
[ ] Bar chart single series
|
68
|
-
[ ] Bar chart multiple series
|
69
|
-
[ ] Discrete y-values, e.g. to visualise events over time
|
70
|
-
[ ] Histogram plotting
|
72
|
+
- [X] Overriding of autoscale
|
73
|
+
- [X] Create nice PNGs
|
74
|
+
- [X] Line plots
|
75
|
+
- [ ] Changing changing the size of the dots
|
76
|
+
- [X] Secondary y-axis
|
77
|
+
- [ ] Bar chart single series
|
78
|
+
- [ ] Bar chart multiple series
|
79
|
+
- [ ] Discrete y-values, e.g. to visualise events over time
|
80
|
+
- [ ] Histogram plotting
|
71
81
|
|
data/bin/heat-map
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'trollop'
|
3
|
+
require 'mkmf'
|
3
4
|
|
4
5
|
DATA_FILE_NAME="/tmp/plot-"+`date "+%s"`.strip+".dat"
|
5
6
|
PLOT_FILE_NAME="/tmp/plot-"+`date "+%s"`.strip+".plt"
|
@@ -16,15 +17,22 @@ end
|
|
16
17
|
|
17
18
|
title = @opts[:title] || ""
|
18
19
|
|
20
|
+
if (!find_executable 'gnuplot')
|
21
|
+
STDERR.puts("This utility depends on gnuplot. Please install gnuplot using your favourite package manager.")
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
19
26
|
# TODO I do want to be streamed!
|
20
27
|
input = `cat`
|
21
28
|
|
22
|
-
|
29
|
+
freq_list = input.split("\n").map{|line|
|
23
30
|
line.split(",").map{|number | number.to_f.round(0)}.join(",")
|
24
31
|
}
|
25
32
|
.group_by{|coords| coords}
|
26
33
|
.map{|pair| [pair[0], pair[1].length]}
|
27
|
-
|
34
|
+
|
35
|
+
freqs=freq_list.inject({}) { |memo, obj|
|
28
36
|
memo[obj.first] = obj.last
|
29
37
|
memo
|
30
38
|
}
|
@@ -85,14 +93,9 @@ end
|
|
85
93
|
|
86
94
|
world_dat=File.join(File.dirname(File.expand_path(__FILE__)), '/../world.dat')
|
87
95
|
|
88
|
-
|
89
96
|
script = <<EOF
|
90
97
|
|
91
|
-
|
92
|
-
|
93
98
|
#{terminal}
|
94
|
-
|
95
|
-
|
96
99
|
set title "#{title}"
|
97
100
|
|
98
101
|
# color definitions
|
@@ -113,7 +116,6 @@ plot '#{DATA_FILE_NAME}' u 2:1:3 w image, \
|
|
113
116
|
'#{world_dat}' with lines linestyle 1
|
114
117
|
EOF
|
115
118
|
|
116
|
-
|
117
119
|
puts "data file " + DATA_FILE_NAME
|
118
120
|
puts "plot file " + PLOT_FILE_NAME
|
119
121
|
|
@@ -121,5 +123,6 @@ puts "plot file " + PLOT_FILE_NAME
|
|
121
123
|
|
122
124
|
File.open(PLOT_FILE_NAME, "w"){|f| f.write(script)}
|
123
125
|
|
124
|
-
|
126
|
+
persistent_opt = @opts[:outfile]?"":"-p"
|
125
127
|
|
128
|
+
`gnuplot #{persistent_opt} #{PLOT_FILE_NAME}`
|
data/bin/scatter-plot
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'trollop'
|
3
|
+
require 'mkmf'
|
3
4
|
|
4
5
|
DATA_FILE_NAME="/tmp/plot-"+`date "+%s"`.strip+".dat"
|
5
6
|
PLOT_FILE_NAME="/tmp/plot-"+`date "+%s"`.strip+".plt"
|
@@ -23,6 +24,11 @@ end
|
|
23
24
|
|
24
25
|
title = @opts[:title] || ""
|
25
26
|
|
27
|
+
if (!find_executable 'gnuplot')
|
28
|
+
STDERR.puts("This utility depends on gnuplot. Please install gnuplot using your favourite package manager.")
|
29
|
+
exit(1)
|
30
|
+
end
|
31
|
+
|
26
32
|
# TODO I do want to be streamed!
|
27
33
|
input = `cat`
|
28
34
|
File.open(DATA_FILE_NAME, "w"){|f| f.write(input)}
|
@@ -83,6 +89,7 @@ EOF
|
|
83
89
|
|
84
90
|
end
|
85
91
|
|
92
|
+
|
86
93
|
if (@opts[:time])
|
87
94
|
timeExpr=@opts[:time]
|
88
95
|
time=<<EOF
|
@@ -131,4 +138,6 @@ puts "plot file " + PLOT_FILE_NAME
|
|
131
138
|
|
132
139
|
File.open(PLOT_FILE_NAME, "w"){|f| f.write(script)}
|
133
140
|
|
134
|
-
|
141
|
+
persistent_opt = @opts[:outfile]?"":"-p"
|
142
|
+
|
143
|
+
`gnuplot #{persistent_opt} #{PLOT_FILE_NAME}`
|
data/visualisation-utils.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = 'utilities for quick visualisation'
|
4
4
|
s.description = 'visualisation-utils provides a number of utilities
|
5
5
|
for visualising data from the command line.'
|
6
|
-
s.version = '0.
|
6
|
+
s.version = '0.6'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
s.files = ['bin/scatter-plot']
|