예제 #1
0
 def contour(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.contour(self, *args, **kwargs)
     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)
     return cset
예제 #2
0
 def contour(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.contour(self, *args, **kwargs)
     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)
     return cset
예제 #3
0
    def contour(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.contour` 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.contour(workspace) #for workspaces
            ax.contour(x,y,z)     #for arrays
            fig.show()

        For keywords related to workspaces, see :func:`mantid.plots.plotfunctions3D.contour`
        '''
        if mantid.plots.helperfunctions.validate_args(*args):
            mantid.kernel.logger.debug('using mantid.plots.plotfunctions3D')
            return mantid.plots.plotfunctions3D.contour(self, *args, **kwargs)
        else:
            return Axes3D.contour(self, *args, **kwargs)
예제 #4
0
    def contour(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.contour` 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.contour(workspace) #for workspaces
            ax.contour(x,y,z)     #for arrays
            fig.show()

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