JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

Projection option for add_subplot #458

Closed adamnemecek closed 5 years ago

adamnemecek commented 5 years ago

Hello, When I call fig.add_subplot with the projection option, I get an error.

Code:

using PyPlot
fig = plt.figure()
ax = fig[:add_subplot](111, projection="3d")

Error:

ERROR: PyError ($(Expr(:escape, :(ccall(#= /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ValueError'>
ValueError("Unknown projection '3d'")
  File "/Users/adamnemecek/.julia/conda/3/lib/python3.7/site-packages/matplotlib/figure.py", line 1396, in add_subplot
    self._process_projection_requirements(*args, **kwargs)
  File "/Users/adamnemecek/.julia/conda/3/lib/python3.7/site-packages/matplotlib/figure.py", line 1120, in _process_projection_requirements
    projection_class = projections.get_projection_class(projection)
  File "/Users/adamnemecek/.julia/conda/3/lib/python3.7/site-packages/matplotlib/projections/__init__.py", line 60, in get_projection_class
    raise ValueError("Unknown projection %r" % projection)

Stacktrace:
 [1] pyerr_check at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
 [2] pyerr_check at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
 [3] macro expansion at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
 [4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::PyCall.PyObject) at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
 [5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Int64}, ::Int64, ::PyCall.PyObject) at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
 [6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{Int64}, ::Base.Iterators.Pairs{Symbol,String,Tuple{Symbol},NamedTuple{(:projection,),Tuple{String}}}) at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11
 [7] #call#111 at /Users/adamnemecek/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89 [inlined]
 [8] (::getfield(PyCall, Symbol("#kw#PyObject")))(::NamedTuple{(:projection,),Tuple{String}}, ::PyCall.PyObject, ::Int64) at ./none:0
 [9] top-level scope at none:0
adamnemecek commented 5 years ago

Actually this was a problem on my end. My bad.