Sha256: f43caa11b224cece60000450cc304f43aeba2d593a3ee33046e01d2e8588c806

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 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 __pyobj__
        @pyplot
      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.20170226 lib/matplotlib/pyplot.rb