lib/mpl_toolkits/mplot3d/axes3d.py
def _3d_extend_contour(self, cset, stride=5):
        '''
        Extend a contour in 3D by creating
        '''

        levels = cset.levels
        colls = cset.collections
        dz = (levels[1] - levels[0]) / 2

        for z, linec in zip(levels, colls):
            topverts = art3d.paths_to_3d_segments(linec.get_paths(), z - dz)
            botverts = art3d.paths_to_3d_segments(linec.get_paths(), z + dz)

            color = linec.get_color()[0]

            polyverts = []
            normals = []
            nsteps = round(len(topverts[0]) / stride)
            if nsteps <= 1:
                if len(topverts[0]) > 1:
                    nsteps = 2
                else:
                    continue

            stepsize = (len(topverts[0]) - 1) / (nsteps - 1)
            for i in range(int(round(nsteps)) - 1):
                i1 = int(round(i * stepsize))
                i2 = int(round((i + 1) * stepsize))
                polyverts.append([topverts[0][i1],
                    topverts[0][i2],
                    botverts[0][i2],
                    botverts[0][i1]])

                v1 = np.array(topverts[0][i1]) - np.array(topverts[0][i2])
                v2 = np.array(topverts[0][i1]) - np.array(botverts[0][i1])
                normals.append(np.cross(v1, v2))

            colors = self._shade_colors(color, normals)
            colors2 = self._shade_colors(color, normals)
            polycol = art3d.Poly3DCollection(polyverts, facecolors=colors,
                edgecolors=colors2)
            polycol.set_sort_zpos(z)
            self.add_collection3d(polycol)

        for col in colls:
            self.collections.remove(col)

        Extend a contour in 3D by creating
        
Extend a contour in 3D by creating
Extend a contour in 3D by creating
def _3d_extend_contour(self, cset, stride=5):
        levels = cset.levels
        colls = cset.collections
        dz = (levels[1] - levels[0]) / 2
        for z, linec in zip(levels, colls):
            topverts = art3d.paths_to_3d_segments(linec.get_paths(), z - dz)
            botverts = art3d.paths_to_3d_segments(linec.get_paths(), z + dz)
            color = linec.get_color()[0]
            polyverts = []
            normals = []
            nsteps = round(len(topverts[0]) / stride)
            if nsteps <= 1:
                if len(topverts[0]) > 1:
                    nsteps = 2
                else:
                    continue
            stepsize = (len(topverts[0]) - 1) / (nsteps - 1)
            for i in range(int(round(nsteps)) - 1):
                i1 = int(round(i * stepsize))
                i2 = int(round((i + 1) * stepsize))
                polyverts.append([topverts[0][i1],
                    topverts[0][i2],
                    botverts[0][i2],
                    botverts[0][i1]])
                v1 = np.array(topverts[0][i1]) - np.array(topverts[0][i2])
                v2 = np.array(topverts[0][i1]) - np.array(botverts[0][i1])
                normals.append(np.cross(v1, v2))
            colors = self._shade_colors(color, normals)
            colors2 = self._shade_colors(color, normals)
            polycol = art3d.Poly3DCollection(polyverts, facecolors=colors,
                edgecolors=colors2)
            polycol.set_sort_zpos(z)
            self.add_collection3d(polycol)
        for col in colls:
            self.collections.remove(col)
def _3d_extend_contour ( self , cset , stride = 5 ) : levels = cset . levels colls = cset . collections dz = ( levels [ 1 ] - levels [ 0 ] ) / 2 for z , linec in zip ( levels , colls ) : topverts = art3d . paths_to_3d_segments ( linec . get_paths ( ) , z - dz ) botverts = art3d . paths_to_3d_segments ( linec . get_paths ( ) , z + dz ) color = linec . get_color ( ) [ 0 ] polyverts = [ ] normals = [ ] nsteps = round ( len ( topverts [ 0 ] ) / stride ) if nsteps <= 1 : if len ( topverts [ 0 ] ) > 1 : nsteps = 2 else : continue stepsize = ( len ( topverts [ 0 ] ) - 1 ) / ( nsteps - 1 ) for i in range ( int ( round ( nsteps ) ) - 1 ) : i1 = int ( round ( i * stepsize ) ) i2 = int ( round ( ( i + 1 ) * stepsize ) ) polyverts . append ( [ topverts [ 0 ] [ i1 ] , topverts [ 0 ] [ i2 ] , botverts [ 0 ] [ i2 ] , botverts [ 0 ] [ i1 ] ] ) v1 = np . array ( topverts [ 0 ] [ i1 ] ) - np . array ( topverts [ 0 ] [ i2 ] ) v2 = np . array ( topverts [ 0 ] [ i1 ] ) - np . array ( botverts [ 0 ] [ i1 ] ) normals . append ( np . cross ( v1 , v2 ) ) colors = self . _shade_colors ( color , normals ) colors2 = self . _shade_colors ( color , normals ) polycol = art3d . Poly3DCollection ( polyverts , facecolors = colors , edgecolors = colors2 ) polycol . set_sort_zpos ( z ) self . add_collection3d ( polycol ) for col in colls : self . collections . remove ( col )
Extend a contour in 3D by creating
Extend a contour in 3D by creating
'''
        Extend a contour in 3D by creating
        '''
self
cset
stride