Repository navigation
Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: mpl_toolkit
Milestone
Description
Bug report
Bug summary
Calling pcolormesh/pcolor or contour/contourf from a parasite axes created with ParasiteAxesAuxTrans breaks. In the call to create the mesh using super_pcolor (or super_contour) an additional self is added to the *args:
| mesh = super_pcolor(self, gx, gy, C, **kwargs) |
This breaks subsequent
pcolor/pcolormesh/pcontour/pcontourf processing.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans
from matplotlib.projections import PolarAxes
from matplotlib.transforms import Affine2D
fig = plt.figure(1, figsize=(7, 4))
ax1 = SubplotHost(fig, 1, 1, 1)
fig.add_subplot(ax1)
tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
ax1.parasites.append(ax2)
data = np.random.random((360,10))
x = np.arange(data.shape[0])
y = np.arange(data.shape[1])
xx, yy = np.meshgrid(x, y)
ax2.pcolormesh(xx, yy, data.T)
ax1.set_xlim(-10, 10)
ax1.set_ylim(-10, 10)
plt.show()Actual outcome
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-3448b36e4131> in <module>()
15 y = np.arange(data.shape[1])
16 xx, yy = np.meshgrid(x, y)
---> 17 ax2.pcolormesh(xx, yy, data.T)
18 ax1.set_xlim(-10, 10)
19 ax1.set_ylim(-10, 10)
/home/kai/miniconda3/envs/wradlib/lib/python3.6/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py in pcolormesh(self, *XYC, **kwargs)
120
121 def pcolormesh(self, *XYC, **kwargs):
--> 122 return self._pcolor(super().pcolormesh, *XYC, **kwargs)
123
124 def pcolor(self, *XYC, **kwargs):
/home/kai/miniconda3/envs/wradlib/lib/python3.6/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py in _pcolor(self, super_pcolor, *XYC, **kwargs)
114 gx = wxy[:, 0].reshape(orig_shape)
115 gy = wxy[:, 1].reshape(orig_shape)
--> 116 mesh = super_pcolor(self, gx, gy, C, **kwargs)
117 mesh.set_transform(self._parent_axes.transData)
118
/home/kai/miniconda3/envs/wradlib/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1783 "the Matplotlib list!)" % (label_namer, func.__name__),
1784 RuntimeWarning, stacklevel=2)
-> 1785 return func(ax, *args, **kwargs)
1786
1787 inner.__doc__ = _add_data_doc(inner.__doc__,
/home/kai/miniconda3/envs/wradlib/lib/python3.6/site-packages/matplotlib/axes/_axes.py in pcolormesh(self, alpha, norm, cmap, vmin, vmax, shading, antialiased, *args, **kwargs)
5957 allmatch = (shading == 'gouraud')
5958
-> 5959 X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)
5960 Ny, Nx = X.shape
5961 X = X.ravel()
/home/kai/miniconda3/envs/wradlib/lib/python3.6/site-packages/matplotlib/axes/_axes.py in _pcolorargs(funcname, allmatch, *args)
5527 else:
5528 raise TypeError(
-> 5529 'Illegal arguments to %s; see help(%s)' % (funcname, funcname))
5530
5531 Nx = X.shape[-1]
TypeError: Illegal arguments to pcolormesh; see help(pcolormesh)
Expected outcome
Works before PR #11678.
Matplotlib version
- Operating system: Linux
- Matplotlib version: 3.0.0
- Matplotlib backend (
print(matplotlib.get_backend())): Qt5Agg - Python version: 3.6.6
- Jupyter version (if applicable):
- Other libraries:
Running conda environment using conda-forge channel.
Metadata
Metadata
Assignees
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: mpl_toolkit

Activity
FIX: remove unnecessary `self` in `super_`-calls, fixes matplotlib#12265
kmuehlbauer commentedon Sep 25, 2018
Since I do not have that much insight into the matplotlib machinery, I can't tell, if this commit is sufficient to fix this. At least it works as expected on my machine. Happy to create a PR.
ImportanceOfBeingErnest commentedon Sep 25, 2018
PRs are welcome. Especially if it could also add a test for this.
Maybe @anntzer can comment on why he put
selfin there in the first place in #11678anntzer commentedon Sep 25, 2018
Because I was hoping that errors like this would be caught by CI? :p
Anyways it's clearly a mistake on my part, the fix looks good, thanks.
FIX: remove unnecessary `self` in `super_`-calls, fixes matplotlib#12265
Backport PR matplotlib#12268: FIX: remove unnecessary `self` in `supe…
Merge pull request #12268 from kmuehlbauer/fix-12265
Merge pull request #12338 from meeseeksmachine/auto-backport-of-pr-12…
MNT: Pin Matplotlib to latest version 2