unifiedPlot 0.0.5 → 0.0.6

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/gemspec +7 -4
  3. data/lib/unifiedPlot.rb +17 -23
  4. metadata +40 -14
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b5cc91ae4b361e3040dd2f577b5f41362d4c9cf71829bf3b1e8945b88b7e6327
4
+ data.tar.gz: 902859243946ec6459f640a8bf5b1b2f97e27ebe6322ec40fa59fbc686fda298
5
+ SHA512:
6
+ metadata.gz: f8811e731d0f5123d661b12cb44dcc78fe5d445b9b34ca8c5b68996c803e6dc9a3348458c1bc6c9fb0290a5b69e4ce03585742f0e1d28e8c909bd30c529ff158
7
+ data.tar.gz: e671e0ebd16a374b7ce4e23e080c60ee3d81c3df9bf573e136700b3ad636573c66a03dfcc36aea46c2e1307cd952f4db8ddd3427c7d11a5061ee880423e90302
data/gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'rubygems'
2
2
 
3
- GEM_SPEC = Gem::Specification.new do |s|
3
+ spec = Gem::Specification.new do |s|
4
4
  s.name = "unifiedPlot"
5
- s.version = '0.0.5'
5
+ s.version = '0.0.6'
6
6
  s.date = Time.new.strftime("%Y-%m-%d")
7
7
 
8
- s.description = 'single interface to line-plotting data in [],NArray and GSL::Vector format'
8
+ s.description = 'single interface to line-plotting data in [] or NArray'
9
9
  s.summary = 'simple line plot for array-based inputs'
10
10
 
11
11
  s.platform = Gem::Platform::RUBY
@@ -15,9 +15,12 @@ GEM_SPEC = Gem::Specification.new do |s|
15
15
  s.author = "Ralf Mueller"
16
16
  s.email = "stark.dreamdetective@gmail.com"
17
17
  s.homepage = "https://github.com/Try2Code/unifiedPlot"
18
- s.licenses = ['BSD']
18
+ s.licenses = '0BSD'
19
19
 
20
20
  s.has_rdoc = false
21
+ s.required_ruby_version = ">= 1.9"
22
+ s.add_development_dependency 'gnuplot', '~> 0'
23
+ s.add_development_dependency 'narray', '~> 0'
21
24
  end
22
25
 
23
26
  # vim:ft=ruby
@@ -1,7 +1,6 @@
1
1
  require 'gnuplot'
2
- require 'gsl'
3
- require 'rubypython'
4
2
  require 'fileutils'
3
+ require 'tempfile'
5
4
 
6
5
  module UnifiedPlot
7
6
 
@@ -36,7 +35,7 @@ module UnifiedPlot
36
35
  # :title => '',
37
36
  # :grid => false,
38
37
  # }
39
- def UnifiedPlot.linePlot(inputs, plotConf =PLOT_DEFAULTS, title ='', oType ='x11',oName ='test')
38
+ def UnifiedPlot.linePlot(inputs, plotConf: PLOT_DEFAULTS, title: '', oType: 'x11',oName: 'test')
40
39
  # allow hash input
41
40
  inputs = [inputs] if inputs.kind_of? Hash
42
41
 
@@ -72,7 +71,8 @@ module UnifiedPlot
72
71
  end
73
72
  return ('x11' != oType) ? [oName,oType].join('.') : nil
74
73
  end
75
- def UnifiedPlot.pm3d(inputs,plotConf = PLOT_DEFAULTS,title = '',oType = 'x11',oName = 'test')
74
+ def UnifiedPlot.pm3d(inputs,plotConf: PLOT_DEFAULTS,title: '',oType: 'x11',oName: 'test')
75
+ tfs = []
76
76
  Gnuplot.open do |gp|
77
77
  Gnuplot::SPlot.new( gp ) do |plot|
78
78
  unless 'x11' == oType
@@ -89,7 +89,9 @@ module UnifiedPlot
89
89
  plot.ytics
90
90
 
91
91
  # write stuff to a file
92
- filename = `tempfile`.chomp
92
+ tf = Tempfile.new('unifiedPlot')
93
+ tfs << tf
94
+ filename = tf.path
93
95
  File.open(filename,'w') {|f|
94
96
  inputs.each {|data|
95
97
  f << data.join(' ')
@@ -106,12 +108,12 @@ module UnifiedPlot
106
108
  end
107
109
  return ('x11' != oType) ? [oName,oType].join('.') : nil
108
110
  end
109
- def UnifiedPlot.heatMap(inputs,plotConf = PLOT_DEFAULTS,title = '',oType = 'x11',oName = 'test')
111
+ def UnifiedPlot.heatMap(input,plotConf: PLOT_DEFAULTS,title: '',oType: 'x11',oName: 'test')
110
112
  plotConf = PLOT_DEFAULTS.merge(plotConf)
111
113
  Gnuplot.open do |gp|
112
114
  Gnuplot::Plot.new( gp ) do |plot|
113
115
  unless 'x11' == oType
114
- plot.terminal oType
116
+ plot.terminal "#{oType} size #{plotConf[:xsize]},#{plotConf[:ysize]} font #{plotConf[:font]} #{plotConf[:fontsize]}"
115
117
  plot.output "#{oName}.#{oType}"
116
118
  end
117
119
 
@@ -122,28 +124,20 @@ module UnifiedPlot
122
124
  plot.xtics
123
125
  plot.ytics
124
126
 
125
- inputs.each {|data|
126
- data = DATA_DEFAULTS.merge(data)
127
- dataset = [data[:x].to_a,data[:y].to_a,data[:z].to_a]
128
- plot.data << Gnuplot::DataSet.new( dataset ) do |ds|
129
- ds.with = 'image'
130
- ds.axes = data[:axes]
131
- ds.title = data[:title]
132
- end
133
- }
127
+ data = DATA_DEFAULTS.merge(input)
128
+ dataset = [data[:x].to_a,data[:y].to_a,data[:z].to_a]
129
+ plot.data << Gnuplot::DataSet.new( dataset ) do |ds|
130
+ ds.with = 'image'
131
+ ds.axes = data[:axes]
132
+ ds.title = data[:title]
133
+ end
134
134
  plot.grid
135
135
  end
136
136
  end
137
137
  return ('x11' != oType) ? [oName,oType].join('.') : nil
138
138
  end
139
- def UnifiedPlot.histogram(inputs)
140
- nbins = 100
141
- max = inputs[:y].abs.max
142
- h = GSL::Histogram.alloc(nbins, [-max, max])
143
- h.fill(inputs[:y])
144
- GSL::graph(h)
145
- end
146
139
  def UnifiedPlot.fieldPlot(inputs)
140
+ require 'rubypython'
147
141
  RubyPython.start
148
142
  pl = RubyPython.import('pylab')
149
143
  pl.imshow(inputs.to_a.reverse)
metadata CHANGED
@@ -1,47 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unifiedPlot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ralf Mueller
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-01-21 00:00:00.000000000 Z
13
- dependencies: []
14
- description: single interface to line-plotting data in [],NArray and GSL::Vector format
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gnuplot
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: narray
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: single interface to line-plotting data in [] or NArray
15
42
  email: stark.dreamdetective@gmail.com
16
43
  executables: []
17
44
  extensions: []
18
45
  extra_rdoc_files: []
19
46
  files:
20
- - lib/unifiedPlot.rb
21
47
  - gemspec
48
+ - lib/unifiedPlot.rb
22
49
  homepage: https://github.com/Try2Code/unifiedPlot
23
50
  licenses:
24
- - BSD
51
+ - 0BSD
52
+ metadata: {}
25
53
  post_install_message:
26
54
  rdoc_options: []
27
55
  require_paths:
28
56
  - lib
29
57
  required_ruby_version: !ruby/object:Gem::Requirement
30
- none: false
31
58
  requirements:
32
- - - ! '>='
59
+ - - ">="
33
60
  - !ruby/object:Gem::Version
34
- version: '0'
61
+ version: '1.9'
35
62
  required_rubygems_version: !ruby/object:Gem::Requirement
36
- none: false
37
63
  requirements:
38
- - - ! '>='
64
+ - - ">="
39
65
  - !ruby/object:Gem::Version
40
66
  version: '0'
41
67
  requirements: []
42
68
  rubyforge_project:
43
- rubygems_version: 1.8.23.2
69
+ rubygems_version: 2.7.4
44
70
  signing_key:
45
- specification_version: 3
71
+ specification_version: 4
46
72
  summary: simple line plot for array-based inputs
47
73
  test_files: []