Sha256: 19be049d254fb6d0e796236cc4990d1be58a216c25acef07dae23fc6d3c8937f

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 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
      next unless obj.kind_of? PyCall::LibPython.PyFunction_Type

      define_singleton_method(name) do |*args, **kwargs|
        obj.(*args, **kwargs)
      end
    end

    class << self
      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.20170224 lib/matplotlib/pyplot.rb