matplotlib 0.1.0.alpha → 0.1.0.alpha.20170224

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87ac553c23778327f5930128ce0aee20d1140fae
4
- data.tar.gz: 0b0902ab2e06747e340a8cad93e522c25441cae3
3
+ metadata.gz: 796cd119c75784e7146fff6e0d741793e25cd86a
4
+ data.tar.gz: 394f6f5df05c16160d93a79f399cac6224507580
5
5
  SHA512:
6
- metadata.gz: df0b4d49f6703fc80968f2cdfb337649b4047eaf050564302d5fc4ebec15053d5ae0a1c1ce9520d94e1388f454116a81dbe2b397292798defd3f4e02c244dc46
7
- data.tar.gz: 2462ed38b19b485cb7064522afb81817056e7c682560dc7cfd5393dce63e03815ba275cdbbb4562f69a471e378172968f5e5f54d3d608d09b4abfc3f871da0db
6
+ metadata.gz: 176d86e71b32af43e3f58a3a2c9f6cbab3bfd01eddb74c64de2771ac2c4fd19ad40d24921b3f0dcfbbec1b33f56bfe09632482b634f77d18373e0fe8cff613e2
7
+ data.tar.gz: ca0d7c387eeefc652e7d048fba34380ec829d092c69998cdd9c2e9b0921e1ba52d3b66201bf716583930b8a9ac88beb1ac95684f764c5c0d83837896ac68c6cf
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in matplotlib.gemspec
4
4
  gemspec
5
+
6
+ gem 'pycall', github: 'mrkn/pycall'
data/bin/console CHANGED
@@ -6,9 +6,5 @@ require "matplotlib"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
9
+ require "pry"
10
+ Pry.start
@@ -0,0 +1,8 @@
1
+ require 'matplotlib/pyplot'
2
+
3
+ plt = Matplotlib::Pyplot
4
+
5
+ xs = [*1..100]
6
+ ys = xs.map {|x| Math.sin(Math::PI * x / 20.0) + 0.1 * (rand - 0.5) }
7
+ plt.plot(xs, ys)
8
+ plt.show
data/lib/matplotlib.rb CHANGED
@@ -1,5 +1,28 @@
1
1
  require "matplotlib/version"
2
+ require 'pycall/import'
2
3
 
3
4
  module Matplotlib
4
- # Your code goes here...
5
+ @matplotlib = PyCall.import_module('matplotlib')
6
+ PyCall.dir(@matplotlib).each do |name|
7
+ obj = PyCall.getattr(@matplotlib, name)
8
+ next unless obj.kind_of? PyCall::PyObject
9
+ next unless obj.kind_of? PyCall::LibPython.PyFunction_Type
10
+
11
+ define_singleton_method(name) do |*args, **kwargs|
12
+ obj.(*args, **kwargs)
13
+ end
14
+ end
15
+
16
+ class << self
17
+ def method_missing(name, *args, **kwargs)
18
+ return super unless PyCall.hasattr?(@matplotlib, name)
19
+ PyCall.getattr(@matplotlib, name)
20
+ end
21
+ end
22
+
23
+ # FIXME: MacOSX backend is unavailable via pycall.
24
+ # I don't know why it is.
25
+ if Matplotlib.get_backend() == 'MacOSX'
26
+ Matplotlib.use('TkAgg')
27
+ end
5
28
  end
@@ -0,0 +1,23 @@
1
+ require 'matplotlib'
2
+
3
+ module Matplotlib
4
+ module Pyplot
5
+ @pyplot = PyCall.import_module('matplotlib.pyplot')
6
+ PyCall.dir(@pyplot).each do |name|
7
+ obj = PyCall.getattr(@pyplot, name)
8
+ next unless obj.kind_of? PyCall::PyObject
9
+ next unless obj.kind_of? PyCall::LibPython.PyFunction_Type
10
+
11
+ define_singleton_method(name) do |*args, **kwargs|
12
+ obj.(*args, **kwargs)
13
+ end
14
+ end
15
+
16
+ class << self
17
+ def method_missing(name, *args, **kwargs)
18
+ return super unless PyCall.hasattr?(@pyplot, name)
19
+ PyCall.getattr(@pyplot, name)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Matplotlib
2
- VERSION = "0.1.0.alpha"
2
+ VERSION = "0.1.0.alpha.20170224"
3
3
  end
data/matplotlib.gemspec CHANGED
@@ -21,7 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.add_dependency "pycall", ">= 0.1.0.alpha.20170224b"
25
+
24
26
  spec.add_development_dependency "bundler", "~> 1.13"
25
27
  spec.add_development_dependency "rake", "~> 10.0"
26
28
  spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "pry"
27
30
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matplotlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha
4
+ version: 0.1.0.alpha.20170224
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Murata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-05 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pycall
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0.alpha.20170224b
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0.alpha.20170224b
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: matplotlib wrapper for Ruby
56
84
  email:
57
85
  - mrkn@mrkn.jp
@@ -68,7 +96,9 @@ files:
68
96
  - Rakefile
69
97
  - bin/console
70
98
  - bin/setup
99
+ - examples/noisy_sin.rb
71
100
  - lib/matplotlib.rb
101
+ - lib/matplotlib/pyplot.rb
72
102
  - lib/matplotlib/version.rb
73
103
  - matplotlib.gemspec
74
104
  homepage: https://github.com/mrkn/matplotlib.rb
@@ -91,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
121
  version: 1.3.1
92
122
  requirements: []
93
123
  rubyforge_project:
94
- rubygems_version: 2.6.3
124
+ rubygems_version: 2.6.8
95
125
  signing_key:
96
126
  specification_version: 4
97
127
  summary: matplotlib wrapper for Ruby