-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
The data keyword argument when calling pcolor cannot be used to pass the xy-coordinates and bin values. From the online documentation, the data keyword should be able to replace "any positional or keyword argument" in pcolor. This issue is demonstrated in the following script.
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
X = np.array([1,2,3,4,5,6])
Y = np.array([1,2,3,4,5,6])
C = np.array([[1,2,3,4,5],
[2,3,4,5,6],
[3,4,5,6,7],
[4,5,6,7,8],
[5,6,7,8,9]])
plt.pcolor(X, Y, C)
plt.show()
plt.pcolor(data = {'X':X, 'Y':Y, 'C':C})
plt.show()Expected behavior: The same plot is displayed twice.
Actual behavior: The first call to pcolor produces the expected plot, but the second call to pcolor gives a TypeError with the following traceback.
Traceback (most recent call last):
File "./example.py", line 17, in <module>
plt.pcolor(data = {'X':X, 'Y':Y, 'C':C})
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 3018, in pcolor
ret = ax.pcolor(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_axes.py", line 4890, in pcolor
X, Y, C = self._pcolorargs('pcolor', *args, allmatch=False)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_axes.py", line 4696, in _pcolorargs
'Illegal arguments to %s; see help(%s)' % (funcname, funcname))
TypeError: Illegal arguments to pcolor; see help(pcolor)
This was tested using Matplotlib v1.4.2 running on Debian 8 (Jessie). Identical results were obtained on both python 2.7.9 and python 3.4.2. Python and matplotlib were installed from apt-get, using the "python", "python-matplotlib", "python3" and "python3-matplotlib" packages.