You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
may be a regression from 1.3 series, reported against 1.4.3, verified against master. Not sure what last version it work on was.
importmatplotlib.pyplotaspltimportnumpyasnpdeffunc3(x, ):
return (1-x/2+x**5+y**3) *np.exp(-x**2-y**2)
# make these smaller to increase the resolutiondx, dy=0.05, 0.05x=np.arange(-3.0, 3.0001, dx)
y=np.arange(-3.0, 3.0001, dy)
X, Y=np.meshgrid(x, y)
Z=func3(X, Y)
# failsplt.pcolor(X, Y, list(Z))
# plt.pcolor(X, Y, Z) # works
Problem is in lib/matplotlib/axes/_axes.py:4969 in _pcolorargs(). It
assumes that the C argument has the .shape attribute.
if len(args) == 1:
C = args[0]
numRows, numCols = C.shape
if allmatch:
X, Y = np.meshgrid(np.arange(numCols), np.arange(numRows))
else:
X, Y = np.meshgrid(np.arange(numCols + 1),
np.arange(numRows + 1))
return X, Y, C
if len(args) == 3:
X, Y, C = args
numRows, numCols = C.shape
else:
raise TypeError(
'Illegal arguments to %s; see help(%s)' % (funcname,
funcname))
Should be pretty straight-forward to just slap on a C = np.asanyarray(C)
before trying to access its shape.
We might need to do something similar for X and Y, but I know that might
have issues with units. Didn't @dopplershift come up with a cbook function
that is like asanyarray, but safer?
Problem is in lib/matplotlib/axes/_axes.py:4969 in _pcolorargs(). It
assumes that the C argument has the .shape attribute.
if len(args) == 1:
C = args[0]
numRows, numCols = C.shape
if allmatch:
X, Y = np.meshgrid(np.arange(numCols), np.arange(numRows))
else:
X, Y = np.meshgrid(np.arange(numCols + 1),
np.arange(numRows + 1))
return X, Y, C
if len(args) == 3:
X, Y, C = args
numRows, numCols = C.shape
else:
raise TypeError(
'Illegal arguments to %s; see help(%s)' % (funcname,
funcname))
Should be pretty straight-forward to just slap on a C = np.asanyarray(C)
before trying to access its shape.
Activity
WeatherGod commentedon Oct 7, 2015
Problem is in lib/matplotlib/axes/_axes.py:4969 in _pcolorargs(). It
assumes that the C argument has the .shape attribute.
Should be pretty straight-forward to just slap on a
C = np.asanyarray(C)before trying to access its shape.
On Wed, Oct 7, 2015 at 2:26 PM, Thomas A Caswell notifications@github.com
wrote:
WeatherGod commentedon Oct 7, 2015
We might need to do something similar for X and Y, but I know that might
have issues with units. Didn't @dopplershift come up with a cbook function
that is like asanyarray, but safer?
On Wed, Oct 7, 2015 at 2:35 PM, Benjamin Root ben.v.root@gmail.com wrote:
dopplershift commentedon Oct 7, 2015
I made a stand-in for
atleast_1d(), since it doesn't preserve subclasses;asanyarray()doesn't have that problem.efiring commentedon Oct 7, 2015
I don't see why one should expect the above to work. Pcolor and
similar functions are in displaying 2-D, so Z fundamentally has to be 2-D.
I would close this as not a bug.
WeatherGod commentedon Oct 7, 2015
@efiring, it is a list of 1-D numpy arrays. Applying asanyarray() would
convert it into a 2D numpy array. I am just about done with a PR to fix
this.
On Wed, Oct 7, 2015 at 2:50 PM, Eric Firing notifications@github.com
wrote:
QuLogic commentedon Dec 3, 2015
Fixed by #5206, I think.