Sha256: 98a20089f2928b53bf8e870b200ce2f47e124491e7f291feee707a4b4cba0b08

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 Bytes

Contents

require "matplotlib/version"
require 'pycall/import'

module Matplotlib
  @matplotlib = PyCall.import_module('matplotlib')
  PyCall.dir(@matplotlib).each do |name|
    obj = PyCall.getattr(@matplotlib, 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__
      @matplotlib
    end

    def method_missing(name, *args, **kwargs)
      return super unless PyCall.hasattr?(@matplotlib, name)
      PyCall.getattr(@matplotlib, name)
    end
  end

  # FIXME: MacOSX backend is unavailable via pycall.
  #        I don't know why it is.
  if Matplotlib.get_backend() == 'MacOSX'
    Matplotlib.use('TkAgg')
  end

  class Error < StandardError
  end
end

require 'matplotlib/axes'
require 'matplotlib/figure'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
matplotlib-0.1.0.alpha.20170302 lib/matplotlib.rb