JuliaPy / PythonPlot.jl

Plotting for Julia based on matplotlib.pyplot
MIT License
74 stars 8 forks source link

Is `PyAny` defined in PythonCall.jl? #19

Closed singularitti closed 1 year ago

singularitti commented 1 year ago

Hi, when I was reading your code, I found this line includes type PyAny, which seems to be defined only in PyCall, but not PythonCall:

(f::Figure)(args...; kws...) = pycall(Py(f), PyAny, args...; kws...)

Could it be a typo?

stevengj commented 1 year ago

I think this is leftover from the PyPlot/PyCall conversion.

I'm actually not sure why we have this method at all. Are Matplotlib figure objects callable?

stevengj commented 1 year ago

Hmm, it stems from https://github.com/JuliaPy/PyPlot.jl/commit/62ff118487c942bbd9b1f38b712981736650d7e6

stevengj commented 1 year ago

Comes from this post on julia-users. Looks like ColorMap objects should be callable, and I added it to Figure for good measure.

stevengj commented 1 year ago

Nope, it's not callable. I get:

ERROR: Python: TypeError: 'Figure' object is not callable

so I should probably just delete this method.

stevengj commented 1 year ago

ColorMap is already okay: https://github.com/stevengj/PythonPlot.jl/blob/08cc7e384bea31b36eb2cc26e01b951a66cc9c61/src/colormaps.jl#L19-L20