Exemplo n.º 1
0
 def contourf(self, *args, **kwargs):
     from art3d_gl import poly_collection_3d_to_gl
     offset = kwargs['offset'] if 'offset' in kwargs else None
     zdir = kwargs['zdir'] if 'zdir' in kwargs else 'z'
     cset = Axes3D.contourf(self, *args, **kwargs)
     edgecolor = kwargs.pop('edgecolor', [1, 1, 1, 0])
     for z, linec in zip(np.argsort(cset.levels), cset.collections):
         convert_to_gl(linec)
         linec.convert_2dpath_to_3dpath(z, zdir='z')
         linec.do_stencil_test = True
         if offset is not None:
             if zdir == 'x': linec._gl_offset = (z * 0.001, 0, 0)
             elif zdir == 'y': linec._gl_offset = (0, z * 0.001, 0)
             else: linec._gl_offset = (0, 0, z * 0.001)
         linec.set_edgecolor((edgecolor, ))
     return cset
Exemplo n.º 2
0
 def contourf(self, *args, **kwargs):
     from art3d_gl import poly_collection_3d_to_gl 
     offset = kwargs['offset'] if 'offset' in kwargs else None
     zdir = kwargs['zdir'] if 'zdir' in kwargs else 'z'
     cset = Axes3D.contourf(self, *args, **kwargs)
     edgecolor = kwargs.pop('edgecolor', [1,1,1,0])
     for z, linec in zip(np.argsort(cset.levels), cset.collections) :
         convert_to_gl(linec)
         linec.convert_2dpath_to_3dpath(z, zdir = 'z')
         linec.do_stencil_test = True
         if offset is not None:
             if zdir == 'x': linec._gl_offset = (z*0.001, 0, 0)
             elif zdir == 'y': linec._gl_offset = (0, z*0.001, 0)
             else: linec._gl_offset = (0, 0, z*0.001)
         linec.set_edgecolor((edgecolor,))
     return cset
Exemplo n.º 3
0
    def contourf(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.contourf` for arrays,
        or it can be used to plot :class:`mantid.api.MatrixWorkspace`
        or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::

            import matplotlib.pyplot as plt
            from mantid import plots

            ...

            fig, ax = plt.subplots(subplot_kw={'projection':'mantid3d'})
            ax.contourf(workspace) #for workspaces
            ax.contourf(x,y,z)     #for arrays
            fig.show()

        For keywords related to workspaces, see :func:`mantid.plots.plotfunctions3D.contourf`
        '''
        if mantid.plots.helperfunctions.validate_args(*args):
            mantid.kernel.logger.debug('using mantid.plots.plotfunctions3D')
            return mantid.plots.plotfunctions3D.contourf(self, *args, **kwargs)
        else:
            return Axes3D.contourf(self, *args, **kwargs)
Exemplo n.º 4
0
    def contourf(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.contourf` for arrays,
        or it can be used to plot :class:`mantid.api.MatrixWorkspace`
        or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::

            import matplotlib.pyplot as plt
            from mantid import plots

            ...

            fig, ax = plt.subplots(subplot_kw={'projection':'mantid3d'})
            ax.contourf(workspace) #for workspaces
            ax.contourf(x,y,z)     #for arrays
            fig.show()

        For keywords related to workspaces, see :func:`mantid.plots.plotfunctions3D.contourf`
        '''
        if mantid.plots.helperfunctions.validate_args(*args):
            mantid.kernel.logger.debug('using mantid.plots.plotfunctions3D')
            return mantid.plots.plotfunctions3D.contourf(self, *args, **kwargs)
        else:
            return Axes3D.contourf(self, *args, **kwargs)