Error using pcolor

279 views
Skip to first unread message

Ronan Chagas

unread,
Apr 11, 2015, 8:14:35 PM4/11/15
to julia...@googlegroups.com
Hi guys,

I'm trying to use pcolor from PyPlot but I'm getting the following error:

julia> using PyPlot
julia> pcolor(rand(10,10))

ERROR: PyError (:PyObject_Call) <type 'exceptions.AttributeError'>
AttributeError("'list' object has no attribute 'shape'",)
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 3012, in pcolor
    ret = ax.pcolor(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_axes.py", line 4875, in pcolor
    X, Y, C = self._pcolorargs('pcolor', *args, allmatch=False)
  File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_axes.py", line 4668, in _pcolorargs
    numRows, numCols = C.shape

 in pyerr_check at /home/ronan.chagas/.julia/v0.3/PyCall/src/exception.jl:60
 in pycall at /home/ronan.chagas/.julia/v0.3/PyCall/src/PyCall.jl:92
 in pcolor at /home/ronan.chagas/.julia/v0.3/PyPlot/src/PyPlot.jl:370

Can anyone help me?

Thanks,
Ronan

Tim Wheeler

unread,
Apr 13, 2015, 12:12:12 PM4/13/15
to julia...@googlegroups.com
The same code works fine on my machine.
Maybe try running Pkg.update()?

Ronan Chagas

unread,
Apr 14, 2015, 10:51:13 AM4/14/15
to julia...@googlegroups.com
Hi Tim,

I still have the same problem.
Can you please tell me what versions of python / matplotlib are you using?

I'm using:

Python = 2.7.8
matplotlib = 1.4.0

Thanks,
Ronan

Kaj Wiik

unread,
Apr 14, 2015, 2:36:49 PM4/14/15
to julia...@googlegroups.com
Works fine with

Julia Version 0.3.7 (Ubuntu)
PyPlot                        1.5.1

python-matplotlib 1.3.1-1ubuntu5
Python 2.7.6

Kaj

Ronan Chagas

unread,
Apr 21, 2015, 12:07:23 PM4/21/15
to julia...@googlegroups.com
I opened an issue in https://github.com/stevengj/PyPlot.jl and @stevengj helped me to figure out the problem.

When I installed Python, numpy, and matplotlib, I forgot that I would also need to install the -devel packages.
Otherwise the headers files will be missing and PyCall would not be able to call numpy to convert the arrays.
After the installation of the following packages:

    _ python-devel
    _ python-numpy-devel

Everything started to work properly.

Thanks,
Ronan
Reply all
Reply to author
Forward
0 new messages