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
Pull request #1646 made large changes to how pcolormesh interpolates its arguments. The new code appears to recalculate the edges when shading is nearest, thus adding an element to both x and y dimensions. But in the process it does not update the shading argument accordingly, causing MPL to complain about incompatible dimensions.
Code to reproduce
A minimal example demonstrating the exception is
importnumpyasnpfrommatplotlibimportpyplotaspltimportcartopy.crsasccrsax=plt.axes(projection=ccrs.PlateCarree())
n=3x=np.arange(n)+1y=np.arange(n)+1d=np.random.rand(n,n)
im=ax.pcolormesh(x, y, d, shading='nearest')
Traceback
The traceback when running the code
Traceback (most recent call last):
File "test.py", line 12, in <module>
im = ax.pcolormesh(x, y, d, shading='nearest')
File "/home/ec2-user/miniconda3/envs/arpav/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py", line 318, in wrapper
return func(self, *args, **kwargs)
File "/home/ec2-user/miniconda3/envs/arpav/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py", line 1797, in pcolormesh
result = matplotlib.axes.Axes.pcolormesh(self, *args, **kwargs)
File "/home/ec2-user/miniconda3/envs/arpav/lib/python3.8/site-packages/matplotlib/__init__.py", line 1361, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "/home/ec2-user/miniconda3/envs/arpav/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 6183, in pcolormesh
X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
File "/home/ec2-user/miniconda3/envs/arpav/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 5711, in _pcolorargs
raise TypeError('Dimensions of C %s are incompatible with'
TypeError: Dimensions of C (3, 3) are incompatible with X (4) and/or Y (4); see help(pcolormesh)
Environment
Conda environment on Amazon Linux with cartopy 0.20.0 from conda-forge and matplotlib-base 3.4.3.
The text was updated successfully, but these errors were encountered:
Description
Pull request #1646 made large changes to how
pcolormesh
interpolates its arguments. The new code appears to recalculate the edges whenshading
isnearest
, thus adding an element to bothx
andy
dimensions. But in the process it does not update theshading
argument accordingly, causing MPL to complain about incompatible dimensions.Code to reproduce
A minimal example demonstrating the exception is
Traceback
The traceback when running the code
Environment
Conda environment on Amazon Linux with
cartopy
0.20.0 from conda-forge andmatplotlib-base
3.4.3.The text was updated successfully, but these errors were encountered: