gnuplotr 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,7 +38,7 @@ Here's a quick example:
38
38
  gp.set_title 'GNUPlotr example'
39
39
  gp.set_xlabel 'x', :offset => 3, :font => "Times New Roman,26"
40
40
  gp.set_ylabel "f(x)"
41
- gp.set_xrange [0:50]
41
+ gp.set_xrange [0:50]
42
42
 
43
43
  # issue plotting commands, either with named data series
44
44
  gp.plot :parabola, "using 1:2 with points axes x1y1"
File without changes
@@ -0,0 +1,47 @@
1
+ ##!/usr/bin/env ruby
2
+ # test.rb
3
+
4
+ # Created by Paolo Bosetti on 2011-02-22.
5
+ # Edited by Carlos Maximiliano Giorgio Bort on 2012-03-05.
6
+ # Copyright (c) 2011 University of Trento. All rights reserved.
7
+
8
+ require './lib/gnuplotr'
9
+
10
+ XMAX = 99
11
+
12
+ # Instantiate
13
+ gp = GNUPlotr.new
14
+ # enable command history recording
15
+ gp.record = true
16
+ # Issue raw gnuplot commands
17
+ gp.raw "set grid"
18
+ # Some magic mapping works too:
19
+ gp.set_grid
20
+ gp.set_title 'GNUPlotr example'
21
+ gp.set_xlabel 'x', :offset => 3, :font => "Times New Roman,26"
22
+ gp.set_ylabel "f(x)"
23
+ j = 1
24
+ while j <= XMAX
25
+ sleep(0.1)
26
+ # Create and fill a new series with pairs. This creates the parabola_2.dat file
27
+ gp.new_series(:parabola)
28
+ (0..j).each do |i|
29
+ gp.series[:parabola] << [i, i**2]
30
+ end
31
+ gp.series[:parabola].close # Remember to call this!
32
+
33
+ gp.new_series(:iperbole)
34
+ (0..j).each do |i|
35
+ gp.series[:iperbole] << [i, 10000/(i+1)]
36
+ end
37
+ gp.series[:iperbole].close # Remember to call this!
38
+ # issue plotting commands, either with named data series
39
+
40
+ gp.plot :parabola, "using 1:2 with points axes x1y1; set xrange [0:#{XMAX}]"
41
+ gp.replot :iperbole, "with lines"
42
+ # or with formulas. Options are collected in a string passed as second optional argument
43
+ gp.replot "x**2", "with lines" # this plots a green parabola f(x) = x^2
44
+ j += 1
45
+ end
46
+ # command history can be dumper and possibly saved on file to be edited or loaded again later on.
47
+ puts gp.dump_input
@@ -0,0 +1,55 @@
1
+ ##!/usr/bin/env ruby
2
+ # test.rb
3
+
4
+ # Created by Paolo Bosetti on 2011-02-22.
5
+ # Copyright (c) 2011 University of Trento. All rights reserved.
6
+
7
+ require './lib/gnuplotr'
8
+
9
+ # Instantiate
10
+ gp = GNUPlotr.new("C:/gnuplot/binary/gnuplot.exe")
11
+
12
+ # Create and fill a new series with pairs. This creates the parabola.dat file
13
+ # Block-based way to do it:
14
+ gp.fill_series(:parabola) do |series|
15
+ (0..99).each do |i|
16
+ series << [i, i**2]
17
+ end
18
+ end
19
+
20
+ # conventional way:
21
+ gp.new_series(:parabola_2)
22
+ (0..99).each do |i|
23
+ gp.series[:parabola_2] << [i, i**2]
24
+ end
25
+ gp.series[:parabola_2].close # Remember to call this!
26
+
27
+
28
+ # enable command history recording
29
+ gp.record = false
30
+
31
+ # Issue raw gnuplot commands
32
+ gp.raw "set grid"
33
+
34
+ # Some magic mapping works too:
35
+ gp.set_grid
36
+ gp.set_title 'GNUPlotr example'
37
+ gp.set_xlabel 'x', :offset => 3, :font => "Times New Roman,26"
38
+ gp.set_ylabel "f(x)"
39
+ gp.set_xrange 0..50
40
+
41
+ # issue plotting commands, either with named data series
42
+ gp.plot :parabola, "using 1:2 with points axes x1y1"
43
+
44
+ # or with formulas. Options are collected in a string passed as second optional argument
45
+ gp.replot "x**2", "with lines"
46
+
47
+
48
+ # command history can be dumper and possibly saved on file to be edited or loaded again later on.
49
+ puts gp.dump_input
50
+
51
+ puts "Press a key for close the graph and quit the process."
52
+ gets
53
+ puts "Exiting"
54
+ gp.raw "show term"
55
+ gp.raw "quit()"
metadata CHANGED
@@ -1,59 +1,54 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gnuplotr
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.5'
4
5
  prerelease:
5
- version: "0.4"
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Paolo Bosetti
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-03-05 00:00:00 -08:00
12
+ date: 2011-03-05 00:00:00.000000000 +01:00
14
13
  default_executable:
15
14
  dependencies: []
16
-
17
15
  description: Interface between Ruby and GNUPlot
18
16
  email: paolo.bosetti@me.com
19
17
  executables: []
20
-
21
18
  extensions: []
22
-
23
19
  extra_rdoc_files: []
24
-
25
- files:
20
+ files:
26
21
  - README.markdown
27
22
  - lib/gnuplotr.rb
28
- - test.rb
23
+ - test_unix.rb
24
+ - test_windows.rb
25
+ - test_unix_animation.rb
29
26
  has_rdoc: true
30
27
  homepage: http://github.com/pbosetti/gnuplotr
31
28
  licenses: []
32
-
33
29
  post_install_message:
34
- rdoc_options:
30
+ rdoc_options:
35
31
  - --inline-source
36
32
  - --charset=UTF-8
37
- require_paths:
33
+ require_paths:
38
34
  - lib
39
- required_ruby_version: !ruby/object:Gem::Requirement
35
+ required_ruby_version: !ruby/object:Gem::Requirement
40
36
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
45
- required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
42
  none: false
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: "0"
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
51
47
  requirements: []
52
-
53
48
  rubyforge_project: gnuplotr
54
- rubygems_version: 1.5.2
49
+ rubygems_version: 1.6.2
55
50
  signing_key:
56
51
  specification_version: 3
57
- summary: Interface between Ruby and GNUPlot, aimed at being as easy to use and as light as possible
52
+ summary: Interface between Ruby and GNUPlot, aimed at being as easy to use and as
53
+ light as possible
58
54
  test_files: []
59
-