Sha256: f9af987480d3d93578683461d1bf04946517e6816b5980f90ce389c5a0496320
Contents?: true
Size: 830 Bytes
Versions: 1
Compression:
Stored size: 830 Bytes
Contents
require 'matplotlib' module Matplotlib module Pyplot @pyplot = PyCall.import_module('matplotlib.pyplot') PyCall.dir(@pyplot).each do |name| obj = PyCall.getattr(@pyplot, name) next unless obj.kind_of?(PyCall::PyObject) || obj.kind_of?(PyCall::PyObjectWrapper) next unless PyCall.callable?(obj) define_singleton_method(name) do |*args, **kwargs| obj.(*args, **kwargs) end end class << self def __pyobj__ @pyplot end def xkcd(scale: 1, length: 100, randomness: 2, &block) PyCall.with(super.(scale: scale, length: length, randomness: randomness), &block) end def method_missing(name, *args, **kwargs) return super unless PyCall.hasattr?(@pyplot, name) PyCall.getattr(@pyplot, name) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
matplotlib-0.1.0.alpha.20170426 | lib/matplotlib/pyplot.rb |