-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
I was trying to migrate this script to ruby
import matplotlib as mpl
mpl.use("Qt5Agg")
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle as rec
fig, ax = plt.subplots(1)
ax.add_artist(rec([1,1],1,1))
ax.set_xlim(0,2)
ax.set_ylim(0,2)
fig.show()
with
require "matplotlib"
Matplotlib.use("Qt5Agg")
require 'matplotlib/pyplot'
plt = Matplotlib::Pyplot
def rec (*args) Matplotlib.patches.Rectangle(*args) end
fig, ax = plt.subplots(1)
ax.add_artist(rec([1,1],1,1))
ax.set_xlim(0,2)
ax.set_ylim(0,2)
fig.show
The python code runs well, but when I run the ruby code, I get following error messages
/var/lib/gems/2.3.0/gems/pycall-0.1.0.alpha.20170711/lib/pycall/pyobject_wrapper.rb:179:in `call': pytype(TypeError): TypeError("set_figure() missing 1 required positional argument: 'fig'",) (PyCall::PyError)
File "/home/kaidonghu/.anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 1739, in add_artist
self._set_artist_props(a)
File "/home/kaidonghu/.anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 924, in _set_artist_props
a.set_figure(self.figure)
from /var/lib/gems/2.3.0/gems/pycall-0.1.0.alpha.20170711/lib/pycall/pyobject_wrapper.rb:34:in `block (2 levels) in wrap_class'
from test.rb:7:in `<main>'
Is there anything I missed to let this happen? Thanks!