Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ParasiteAxesAuxTrans pcolor/pcolormesh and contour/contourf broken #12265

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: mpl_toolkit
Milestone
@kmuehlbauer

Description

@kmuehlbauer

Bug report

Bug summary

Callingpcolormesh/pcolor orcontour/contourf from a parasite axes created withParasiteAxesAuxTrans breaks. In the call to create the mesh usingsuper_pcolor (orsuper_contour) an additionalself is added to the *args:

mesh=super_pcolor(self,gx,gy,C,**kwargs)

This breaks subsequentpcolor/pcolormesh/pcontour/pcontourf processing.

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfrommpl_toolkits.axisartistimportSubplotHost,ParasiteAxesAuxTransfrommatplotlib.projectionsimportPolarAxesfrommatplotlib.transformsimportAffine2Dfig=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

parasite_axes

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

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: mpl_toolkit

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp