unifiedPlot 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/gemspec +1 -1
- data/lib/unifiedPlot.rb +98 -2
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 871c40a719cbfb7f354b670da99f850abd42caad
|
4
|
+
data.tar.gz: c71d375f4a014d2addf179b28690895e11c7ca4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3f4b56a4cc0c0b1836866d516d6f1d63f92df881889254cdfe89fd346bdb43b56d79f69f759f9152f682b68aa125710e6c6b9f95ed0cfadcb8b01148fb1e4f3
|
7
|
+
data.tar.gz: fdbb04ce285a46c10b70c16ead2fa96f0f18b6059084147d14410557abf2e9b5565c3ce85ca214e0e6235ac28ad29797f0c847a8f8c1f9b1eff1ea932f215161
|
data/gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
GEM_SPEC = Gem::Specification.new do |s|
|
4
4
|
s.name = "unifiedPlot"
|
5
|
-
s.version = '0.0.
|
5
|
+
s.version = '0.0.2'
|
6
6
|
s.date = Time.new.strftime("%Y-%m-%d")
|
7
7
|
|
8
8
|
s.description = 'single interface to line-plotting data in [],NArray and GSL::Vector format'
|
data/lib/unifiedPlot.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'gnuplot'
|
2
|
+
require 'rubypython'
|
3
|
+
require 'fileutils'
|
2
4
|
|
3
5
|
module UnifiedPlot
|
4
6
|
|
@@ -9,6 +11,10 @@ module UnifiedPlot
|
|
9
11
|
:xlabel => nil,
|
10
12
|
:x2label => nil,
|
11
13
|
:label_position => 'bottom out',
|
14
|
+
:xsize => 1200,
|
15
|
+
:ysize => 800,
|
16
|
+
:font => 'arial',
|
17
|
+
:fontsize => 10,
|
12
18
|
}
|
13
19
|
DATA_DEFAULTS = {
|
14
20
|
:title => '',
|
@@ -27,13 +33,18 @@ module UnifiedPlot
|
|
27
33
|
# :xlabel => '',
|
28
34
|
# :ylabel => '',
|
29
35
|
# :title => '',
|
30
|
-
# :grid => false
|
36
|
+
# :grid => false,
|
31
37
|
# }
|
32
38
|
def UnifiedPlot.linePlot(inputs, plotConf: PLOT_DEFAULTS, title: '', oType: 'x11',oName: 'test')
|
39
|
+
# allow hash input
|
40
|
+
inputs = [inputs] if inputs.kind_of? Hash
|
41
|
+
|
42
|
+
plotConf = PLOT_DEFAULTS.merge(plotConf) unless plotConf == PLOT_DEFAULTS
|
43
|
+
|
33
44
|
Gnuplot.open do |gp|
|
34
45
|
Gnuplot::Plot.new( gp ) do |plot|
|
35
46
|
unless 'x11' == oType
|
36
|
-
plot.terminal oType
|
47
|
+
plot.terminal "#{oType} size #{plotConf[:xsize]},#{plotConf[:ysize]} font #{plotConf[:font]} #{plotConf[:fontsize]}"
|
37
48
|
plot.output "#{oName}.#{oType}"
|
38
49
|
end
|
39
50
|
|
@@ -68,4 +79,89 @@ module UnifiedPlot
|
|
68
79
|
end
|
69
80
|
end
|
70
81
|
end
|
82
|
+
def UnifiedPlot.pm3d(inputs,plotConf: PLOT_DEFAULTS,title: '',oType: 'x11',oName: 'test')
|
83
|
+
Gnuplot.open do |gp|
|
84
|
+
Gnuplot::SPlot.new( gp ) do |plot|
|
85
|
+
unless 'x11' == oType
|
86
|
+
plot.terminal oType
|
87
|
+
plot.output "#{oName}.#{oType}"
|
88
|
+
end
|
89
|
+
|
90
|
+
plotConf = PLOT_DEFAULTS.merge(plotConf)
|
91
|
+
plot.title title
|
92
|
+
plot.key plotConf[:label_position]
|
93
|
+
|
94
|
+
plot.xrange plotConf[:xrange] unless plotConf[:xrange].nil?
|
95
|
+
plot.x2range plotConf[:x2range] unless plotConf[:x2range].nil?
|
96
|
+
plot.yrange plotConf[:yrange] unless plotConf[:yrange].nil?
|
97
|
+
plot.y2range plotConf[:y2range] unless plotConf[:y2range].nil?
|
98
|
+
|
99
|
+
plot.xtics
|
100
|
+
plot.ytics
|
101
|
+
|
102
|
+
plot.xlabel plotConf[:xlabel]
|
103
|
+
plot.x2label plotConf[:x2label]
|
104
|
+
plot.ylabel plotConf[:ylabel]
|
105
|
+
plot.y2label plotConf[:y2label]
|
106
|
+
|
107
|
+
# write stuff to a file
|
108
|
+
filename = `tempfile`.chomp
|
109
|
+
File.open(filename,'w') {|f|
|
110
|
+
inputs.each {|data|
|
111
|
+
f << data.join(' ')
|
112
|
+
f << "\n"
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
plot.view "map"
|
117
|
+
plot.data << Gnuplot::DataSet.new("'"+filename+"'") do |ds|
|
118
|
+
ds.with = "image"
|
119
|
+
ds.matrix = true
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
def UnifiedPlot.heatMap(inputs,plotConf: PLOT_DEFAULTS,title: '',oType: 'x11',oName: 'test')
|
125
|
+
Gnuplot.open do |gp|
|
126
|
+
Gnuplot::Plot.new( gp ) do |plot|
|
127
|
+
unless 'x11' == oType
|
128
|
+
plot.terminal oType
|
129
|
+
plot.output "#{oName}.#{oType}"
|
130
|
+
end
|
131
|
+
|
132
|
+
plotConf = PLOT_DEFAULTS.merge(plotConf)
|
133
|
+
plot.title title
|
134
|
+
plot.key plotConf[:label_position]
|
135
|
+
|
136
|
+
plot.xrange plotConf[:xrange] unless plotConf[:xrange].nil?
|
137
|
+
plot.x2range plotConf[:x2range] unless plotConf[:x2range].nil?
|
138
|
+
plot.yrange plotConf[:yrange] unless plotConf[:yrange].nil?
|
139
|
+
plot.y2range plotConf[:y2range] unless plotConf[:y2range].nil?
|
140
|
+
|
141
|
+
plot.xtics
|
142
|
+
plot.ytics
|
143
|
+
|
144
|
+
plot.xlabel plotConf[:xlabel]
|
145
|
+
plot.x2label plotConf[:x2label]
|
146
|
+
plot.ylabel plotConf[:ylabel]
|
147
|
+
plot.y2label plotConf[:y2label]
|
148
|
+
inputs.each {|data|
|
149
|
+
data = DATA_DEFAULTS.merge(data)
|
150
|
+
dataset = [data[:x].to_a,data[:y].to_a,data[:z].to_a]
|
151
|
+
plot.data << Gnuplot::DataSet.new( dataset ) do |ds|
|
152
|
+
ds.with = 'image'
|
153
|
+
ds.axes = data[:axes]
|
154
|
+
ds.title = data[:title]
|
155
|
+
end
|
156
|
+
}
|
157
|
+
plot.grid
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
def UnifiedPlot.fieldPlot(inputs)
|
162
|
+
RubyPython.start
|
163
|
+
pl = RubyPython.import('pylab')
|
164
|
+
pl.imshow(inputs.to_a.reverse)
|
165
|
+
pl.show()
|
166
|
+
end
|
71
167
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unifiedPlot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralf Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: single interface to line-plotting data in [],NArray and GSL::Vector format
|
14
14
|
email: stark.dreamdetective@gmail.com
|
@@ -16,8 +16,8 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
- lib/unifiedPlot.rb
|
20
19
|
- gemspec
|
20
|
+
- lib/unifiedPlot.rb
|
21
21
|
homepage: https://github.com/Try2Code/unifiedPlot
|
22
22
|
licenses:
|
23
23
|
- BSD
|
@@ -38,9 +38,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
version: '0'
|
39
39
|
requirements: []
|
40
40
|
rubyforge_project:
|
41
|
-
rubygems_version: 2.0
|
41
|
+
rubygems_version: 2.2.0
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: simple line plot for array-based inputs
|
45
45
|
test_files: []
|
46
|
-
has_rdoc: false
|