matplotlib 0.1.0.alpha.20170226 → 0.1.0.alpha.20170302
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/examples/classifier_comparison.ipynb +253 -0
- data/examples/forest_importances.ipynb +254 -0
- data/examples/iruby_integration.ipynb +28 -2
- data/examples/lorenz_attractor.ipynb +248 -0
- data/examples/polar_axes.ipynb +243 -0
- data/lib/matplotlib.rb +9 -6
- data/lib/matplotlib/axes.rb +28 -0
- data/lib/matplotlib/axes_3d.rb +28 -0
- data/lib/matplotlib/figure.rb +28 -0
- data/lib/matplotlib/iruby.rb +0 -2
- data/lib/matplotlib/pyplot.rb +2 -2
- data/lib/matplotlib/version.rb +1 -1
- data/matplotlib.gemspec +1 -1
- metadata +11 -4
data/lib/matplotlib.rb
CHANGED
@@ -5,8 +5,8 @@ module Matplotlib
|
|
5
5
|
@matplotlib = PyCall.import_module('matplotlib')
|
6
6
|
PyCall.dir(@matplotlib).each do |name|
|
7
7
|
obj = PyCall.getattr(@matplotlib, name)
|
8
|
-
next unless obj.kind_of? PyCall::
|
9
|
-
next unless
|
8
|
+
next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper)
|
9
|
+
next unless PyCall.callable?(obj)
|
10
10
|
|
11
11
|
define_singleton_method(name) do |*args, **kwargs|
|
12
12
|
obj.(*args, **kwargs)
|
@@ -14,6 +14,10 @@ module Matplotlib
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class << self
|
17
|
+
def __pyobj__
|
18
|
+
@matplotlib
|
19
|
+
end
|
20
|
+
|
17
21
|
def method_missing(name, *args, **kwargs)
|
18
22
|
return super unless PyCall.hasattr?(@matplotlib, name)
|
19
23
|
PyCall.getattr(@matplotlib, name)
|
@@ -28,8 +32,7 @@ module Matplotlib
|
|
28
32
|
|
29
33
|
class Error < StandardError
|
30
34
|
end
|
31
|
-
|
32
|
-
class Figure
|
33
|
-
include PyCall::PyObjectWrapper
|
34
|
-
end
|
35
35
|
end
|
36
|
+
|
37
|
+
require 'matplotlib/axes'
|
38
|
+
require 'matplotlib/figure'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Matplotlib
|
2
|
+
class Axes3D
|
3
|
+
include PyCall::PyObjectWrapper
|
4
|
+
|
5
|
+
@__pyobj__ = PyCall.import_module('matplotlib.axes').Axes
|
6
|
+
|
7
|
+
PyCall.dir(@__pyobj__).each do |name|
|
8
|
+
obj = PyCall.getattr(@__pyobj__, name)
|
9
|
+
next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper)
|
10
|
+
next unless PyCall.callable?(obj)
|
11
|
+
|
12
|
+
define_method(name) do |*args, **kwargs|
|
13
|
+
PyCall.getattr(__pyobj__, name).(*args, **kwargs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_reader :__pyobj__
|
19
|
+
|
20
|
+
def method_missing(name, *args, **kwargs)
|
21
|
+
return super unless PyCall.hasattr?(__pyobj__, name)
|
22
|
+
PyCall.getattr(__pyobj__, name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
PyCall::Conversions.python_type_mapping(__pyobj__, self)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Matplotlib
|
2
|
+
class Axes3D
|
3
|
+
include PyCall::PyObjectWrapper
|
4
|
+
|
5
|
+
@__pyobj__ = PyCall.import_module('mpl_toolkits.mplot3d').Axes3D
|
6
|
+
|
7
|
+
PyCall.dir(@__pyobj__).each do |name|
|
8
|
+
obj = PyCall.getattr(@__pyobj__, name)
|
9
|
+
next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper)
|
10
|
+
next unless PyCall.callable?(obj)
|
11
|
+
|
12
|
+
define_method(name) do |*args, **kwargs|
|
13
|
+
PyCall.getattr(__pyobj__, name).(*args, **kwargs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_reader :__pyobj__
|
19
|
+
|
20
|
+
def method_missing(name, *args, **kwargs)
|
21
|
+
return super unless PyCall.hasattr?(__pyobj__, name)
|
22
|
+
PyCall.getattr(__pyobj__, name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
PyCall::Conversions.python_type_mapping(__pyobj__, self)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Matplotlib
|
2
|
+
class Figure
|
3
|
+
include PyCall::PyObjectWrapper
|
4
|
+
|
5
|
+
@__pyobj__ = PyCall.import_module('matplotlib.figure').Figure
|
6
|
+
|
7
|
+
PyCall.dir(@__pyobj__).each do |name|
|
8
|
+
obj = PyCall.getattr(@__pyobj__, name)
|
9
|
+
next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper)
|
10
|
+
next unless PyCall.callable?(obj)
|
11
|
+
|
12
|
+
define_method(name) do |*args, **kwargs|
|
13
|
+
PyCall.getattr(__pyobj__, name).(*args, **kwargs)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_reader :__pyobj__
|
19
|
+
|
20
|
+
def method_missing(name, *args, **kwargs)
|
21
|
+
return super unless PyCall.hasattr?(__pyobj__, name)
|
22
|
+
PyCall.getattr(__pyobj__, name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
PyCall::Conversions.python_type_mapping(__pyobj__, self)
|
27
|
+
end
|
28
|
+
end
|
data/lib/matplotlib/iruby.rb
CHANGED
@@ -32,8 +32,6 @@ module Matplotlib
|
|
32
32
|
# NOTE: This method is translated from `IPython.core.activate_matplotlib` function.
|
33
33
|
def activate(gui=:inline)
|
34
34
|
require 'matplotlib/pyplot'
|
35
|
-
figure_class = Pyplot.__pyobj__.Figure
|
36
|
-
PyCall::Conversions.python_type_mapping(figure_class, Figure)
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
data/lib/matplotlib/pyplot.rb
CHANGED
@@ -5,8 +5,8 @@ module Matplotlib
|
|
5
5
|
@pyplot = PyCall.import_module('matplotlib.pyplot')
|
6
6
|
PyCall.dir(@pyplot).each do |name|
|
7
7
|
obj = PyCall.getattr(@pyplot, name)
|
8
|
-
next unless obj.kind_of? PyCall::
|
9
|
-
next unless
|
8
|
+
next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper)
|
9
|
+
next unless PyCall.callable?(obj)
|
10
10
|
|
11
11
|
define_singleton_method(name) do |*args, **kwargs|
|
12
12
|
obj.(*args, **kwargs)
|
data/lib/matplotlib/version.rb
CHANGED
data/matplotlib.gemspec
CHANGED
@@ -21,7 +21,7 @@ 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.
|
24
|
+
spec.add_dependency "pycall", ">= 0.1.0.alpha.20170302"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.13"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.20170302
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pycall
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.0.alpha.
|
19
|
+
version: 0.1.0.alpha.20170302
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.0.alpha.
|
26
|
+
version: 0.1.0.alpha.20170302
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,9 +96,16 @@ files:
|
|
96
96
|
- Rakefile
|
97
97
|
- bin/console
|
98
98
|
- bin/setup
|
99
|
+
- examples/classifier_comparison.ipynb
|
100
|
+
- examples/forest_importances.ipynb
|
99
101
|
- examples/iruby_integration.ipynb
|
102
|
+
- examples/lorenz_attractor.ipynb
|
100
103
|
- examples/noisy_sin.rb
|
104
|
+
- examples/polar_axes.ipynb
|
101
105
|
- lib/matplotlib.rb
|
106
|
+
- lib/matplotlib/axes.rb
|
107
|
+
- lib/matplotlib/axes_3d.rb
|
108
|
+
- lib/matplotlib/figure.rb
|
102
109
|
- lib/matplotlib/iruby.rb
|
103
110
|
- lib/matplotlib/pyplot.rb
|
104
111
|
- lib/matplotlib/version.rb
|