• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mlab.outline函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mayavi.mlab.outline函数的典型用法代码示例。如果您正苦于以下问题:Python outline函数的具体用法?Python outline怎么用?Python outline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了outline函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: animateGIF

def animateGIF(filename, prices):
    '''Creates a mayavi visualization of a pd DataFrame containing stock prices
    Then uses MoviePy to animate and save as a gif
    Inputs:
    prices => a pd DataFrame, w/ index: dates; columns: company names
    '''
    #Because of mayavi requirements, replace dates and company names with integers
    #until workaround is figured out
    x_length, y_length = prices.shape
    xTime = np.array([list(xrange(x_length)),] * y_length).transpose()
    yCompanies = np.array([list(xrange(y_length)),] * x_length)
    
    #Sort indexed prices by total return on last date
    lastDatePrices = prices.iloc[-1]
    lastDatePrices.sort_values(inplace=True)
    sortOrder = lastDatePrices.index
    zPrices = prices[sortOrder]
    
    
    #Create mayavi2 object
    dims = xTime.shape
    fig = mlab.figure(bgcolor=(.4,.4,.4))
    vis = mlab.surf(xTime, yCompanies, zPrices)
    mlab.outline(vis)
    mlab.orientation_axes(vis)
    mlab.axes(vis, nb_labels=0, xlabel = 'Time', ylabel = 'Company', zlabel = 'Price')
    
#    duration = 2 #Duration of the animation in seconds (will loop)
    
    animation = mpy.VideoClip(make_frame, duration = 4).resize(1.0)
#    animation.write_videofile('prototype_animation.mp4', fps=20)
    animation.write_gif(filename, fps=20)
开发者ID:mzaccari,项目名称:market-vis,代码行数:32,代码来源:visualization.py


示例2: animateGIF

def animateGIF(filename, prices):
    '''Creates a mayavi visualization of a pd DataFrame containing stock prices
    Then uses MoviePy to animate and save as a gif
    Inputs:
    prices => a pd DataFrame, w/ index: dates; columns: company names
    '''
     #Imports mlab here to delay starting of mayavi engine until necessary
    from mayavi import mlab
    
    #Because of current mayavi requirements, replaces dates and company names with integers
    x_length, y_length = prices.shape
    xTime = np.array([list(xrange(x_length)),] * y_length).transpose()
    yCompanies = np.array([list(xrange(y_length)),] * x_length)
    
    #Sort indexed prices by total return on last date
    lastDatePrices = prices.iloc[-1]
    lastDatePrices.sort_values(inplace=True)
    sortOrder = lastDatePrices.index
    zPrices = prices[sortOrder]
    
    #Create mayavi2 object
    fig = mlab.figure(bgcolor=(.4,.4,.4))
    vis = mlab.surf(xTime, yCompanies, zPrices)
    mlab.outline(vis)
    mlab.orientation_axes(vis)
    mlab.axes(vis, nb_labels=0, xlabel = 'Time', ylabel = 'Company', zlabel = 'Price')
    
    animation = mpy.VideoClip(make_frame, duration = 4).resize(1.0)
    animation.write_gif(filename, fps=20)
    
开发者ID:ryanpstauffer,项目名称:market-vis,代码行数:29,代码来源:visualization.py


示例3: visualization3D_notimage

def visualization3D_notimage(image3D):
    """
    :param image3D: image object from readDirWithBinaryDAta
    :return:
    """

    s=image3D
    src = mlab.pipeline.scalar_field(image3D)
    src.spacing=[1,1,5]
    src.update_image_data = (1,1,5)
    '''
    mlab.pipeline.image_plane_widget(src,
                                     plane_orientation='x_axes',
                                     slice_index=1,
                                    colormap='black-white'


    )
    mlab.pipeline.image_plane_widget(src,
                                     plane_orientation='z_axes',
                                     slice_index=1,
                                     colormap='black-white'


    )
    '''



    mlab.pipeline.iso_surface(src, contours=[0.5,1], opacity=1,colormap='black-white')

    mlab.outline()

    mlab.show()
开发者ID:DanielGutmann,项目名称:DICOM,代码行数:34,代码来源:Vizualization.py


示例4: labels

	def labels(self):
		'''
		Add 3d text to show the axes.
		'''
		fontsize = max(self.xrang, self.yrang)/40.
		tcolor = (1,1,1)
		mlab.text3d(self.xrang/2,-40,self.zrang+40,'R.A.',scale=fontsize,orient_to_camera=True,color=tcolor)
		mlab.text3d(-40,self.yrang/2,self.zrang+40,'Decl.',scale=fontsize,orient_to_camera=True,color=tcolor)
		mlab.text3d(-40,-40,self.zrang/2-10,'V (km/s)',scale=fontsize,orient_to_camera=True,color=tcolor)
		# Label the coordinates of the corners
		# Lower left corner
		ra0 = self.extent[0]; dec0 = self.extent[2]
		c = coord.ICRS(ra=ra0, dec=dec0, unit=(u.degree, u.degree))
		RA_ll = str(int(c.ra.hms.h))+'h'+str(int(c.ra.hms.m))+'m'+str(round(c.ra.hms.s,1))+'s'
		mlab.text3d(0,-20,self.zrang+20,RA_ll,scale=fontsize,orient_to_camera=True,color=tcolor)
		DEC_ll = str(int(c.dec.dms.d))+'d'+str(int(abs(c.dec.dms.m)))+'m'+str(round(abs(c.dec.dms.s),1))+'s'
		mlab.text3d(-80,0,self.zrang+20,DEC_ll,scale=fontsize,orient_to_camera=True,color=tcolor)
		# Upper right corner
		ra0 = self.extent[1]; dec0 = self.extent[3]
		c = coord.ICRS(ra=ra0, dec=dec0, unit=(u.degree, u.degree))
		RA_ll = str(int(c.ra.hms.h))+'h'+str(int(c.ra.hms.m))+'m'+str(round(c.ra.hms.s,1))+'s'
		mlab.text3d(self.xrang,-20,self.zrang+20,RA_ll,scale=fontsize,orient_to_camera=True,color=tcolor)
		DEC_ll = str(int(c.dec.dms.d))+'d'+str(int(abs(c.dec.dms.m)))+'m'+str(round(abs(c.dec.dms.s),1))+'s'
		mlab.text3d(-80,self.yrang,self.zrang+20,DEC_ll,scale=fontsize,orient_to_camera=True,color=tcolor)
		# V axis
		if self.extent[5] > self.extent[4]:
			v0 = self.extent[4]; v1 = self.extent[5]
		else:
			v0 = self.extent[5]; v1 = self.extent[4]
		mlab.text3d(-20,-20,self.zrang,str(round(v0,1)),scale=fontsize,orient_to_camera=True,color=tcolor)
		mlab.text3d(-20,-20,0,str(round(v1,1)),scale=fontsize,orient_to_camera=True,color=tcolor)

		mlab.axes(self.field, ranges=self.extent, x_axis_visibility=False, y_axis_visibility=False, z_axis_visibility=False)
		mlab.outline()
开发者ID:TuahZh,项目名称:tdviz,代码行数:34,代码来源:TDViz.py


示例5: _plot_max_Value

    def _plot_max_Value( self ):
        X = self.X_hf[:, 0]
        Y = self.Y_hf[:, 0]
        Z = self.Z_hf[:, 0]


        plot_col = getattr( self, self.plot_column )[:, 0]
        scale = 1 / max( plot_col )
#        if self.plot_column == 'n_tex':
#            plot_col = where( plot_col < 0, 0, plot_col )

        mlab.figure( figure = "SFB532Demo",
                     bgcolor = ( 1.0, 1.0, 1.0 ),
                     fgcolor = ( 0.0, 0.0, 0.0 ) )

        mlab.points3d( X, Y, ( -1.0 ) * Z, plot_col,
#                       colormap = "gist_rainbow",
#                       colormap = "Reds",
                       colormap = "copper",
                       mode = "cube",
                       scale_factor = scale )
        mlab.outline()

        mlab.scalarbar( title = self.plot_column, orientation = 'vertical' )

        mlab.show
开发者ID:simvisage,项目名称:simvisage,代码行数:26,代码来源:ls_table_hf.py


示例6: PlotHorizon3d

def PlotHorizon3d(tss):
    """
    Plot a list of horizons.

    Parameters
    ----------

    tss : list of trappedsurface
        All the trapped surfaces to visualize.
    """
    from mayavi import mlab
    cmaps = ['bone', 'jet', 'hot', 'cool', 'spring', 'summer', 'winter']
    assert len(cmaps) > len(tss)
    extents = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    for ts, cm in zip(tss, cmaps):
        mlab.mesh(ts.X, ts.Y, ts.Z, colormap=cm, opacity=0.4)
        extents[0] = min(extents[0], np.min(ts.X))
        extents[1] = max(extents[1], np.max(ts.X))
        extents[2] = min(extents[2], np.min(ts.Y))
        extents[3] = max(extents[3], np.max(ts.Y))
        extents[4] = min(extents[4], np.min(ts.Z))
        extents[5] = max(extents[5], np.max(ts.Z))
    mlab.axes(extent=extents)
    mlab.outline(extent=extents)
    mlab.show()
开发者ID:jcmuddle,项目名称:findhorizon,代码行数:25,代码来源:findhorizon.py


示例7: displayDensity

    def displayDensity(self, densityValues):
        self.numberOfElectrons(densityValues)
        source = mlab.pipeline.scalar_field(self.x, self.y, self.z, 
                                            densityValues)    
        densityPlot = mlab.pipeline.image_plane_widget(source,
                        colormap="hot",opacity = 1, transparent=True,                   
                        plane_orientation='x_axes',vmin = self.vmin,
                                vmax = self.vmax*0.01,
                        slice_index=20,)

        densityPlot = mlab.pipeline.image_plane_widget(source,
                    colormap="hot",  opacity = 1,transparent=True,vmin = self.vmin,
                                vmax = self.vmax*0.01,
                    plane_orientation='y_axes',
                    slice_index=20,)         
                    
        densityPlot = mlab.pipeline.image_plane_widget(source,
                colormap="hot",   opacity = 1, transparent=True, vmin = self.vmin,
                                vmax = self.vmax*0.01,                            
                plane_orientation='z_axes',
                slice_index=20,)    
                
        mlab.outline()
#        mlab.axes()
        
        return densityPlot.mlab_source 
开发者ID:miladh,项目名称:cubeViz,代码行数:26,代码来源:cubeViz.py


示例8: _showSimple

        def _showSimple():
            maxInterpolPts = 10
            
            def interpolateSection(section):
                sStart = section.getDistalNPA4()
                sEnd = section.getProximalNPA4()
                length = section.getLength()
                rad = min(section.d_r, section.p_r)  
                n = min( max( int( lToRRatio * length / rad ), 1 ), maxInterpolPts)
                jVecSteps = ( sEnd-sStart ) / n
                
                intPts = [ sStart + k*jVecSteps for k in range(0,n) ]
                return intPts 
                
            lbs = []
            for morph in self.morphs:
                lb = Flatten( ListBuilderSectionVisitor(functor=interpolateSection,  morph=morph ) () ) 
                lbs.extend( lb )
                
            
            pts = numpy.array( lbs )

            x = pts[:, 0]
            y = pts[:, 1]
            z = pts[:, 2]
            s = pts[:, 3]
            
            mlab.points3d(x, y, z, s, colormap=self.colormap, scale_factor=self.scale_factor)
            mlab.outline()
开发者ID:unidesigner,项目名称:morphforge,代码行数:29,代码来源:mayavirenderer.py


示例9: plot3D

def plot3D(name, X, Y, Z, zlabel):
    """
    Plots a 3d surface plot of Z using the mayavi mlab.mesh function.

    Parameters
    ----------
    name: string
        The name of the figure.
    X: 2d ndarray
        The x-axis data.
    Y: 2d ndarray
        The y-axis data.
    Z: 2d nd array
        The z-axis data.
    zlabel: The title that appears on the z-axis.
    """
    mlab.figure(name)
    mlab.clf()
    plotData = mlab.mesh(X/(np.max(X) - np.min(X)),
                         Y/(np.max(Y) - np.min(Y)),
                         Z/(np.max(Z) - np.min(Z)))
    mlab.outline(plotData)
    mlab.axes(plotData, ranges=[np.min(X), np.max(X),
                                np.min(Y), np.max(Y),
                                np.min(Z), np.max(Z)])
    mlab.xlabel('Space ($x$)')
    mlab.ylabel('Time ($t$)')
    mlab.zlabel(zlabel)
开发者ID:Rhys314,项目名称:Simulating_Hamiltonian_Dynamics,代码行数:28,代码来源:ThreeDimensions.py


示例10: visualizePrices

def visualizePrices(prices):
    '''Creates a mayavi visualization of a pd DataFrame containing stock prices
    Inputs:
    prices => a pd DataFrame, w/ index: dates; columns: company names
    '''
    #Because of mayavi requirements, replace dates and company names with integers
    #until workaround is figured out
    x_length, y_length = prices.shape
    xTime = np.array([list(xrange(x_length)),] * y_length).transpose()
    yCompanies = np.array([list(xrange(y_length)),] * x_length)
    
    #Sort indexed prices by total return on last date
    lastDatePrices = prices.iloc[-1]
    lastDatePrices.sort_values(inplace=True)
    sortOrder = lastDatePrices.index
    zPrices = prices[sortOrder]
    
    #Create mayavi2 object
    dims = xTime.shape
    fig = mlab.figure(bgcolor=(.4,.4,.4))
    vis = mlab.surf(xTime, yCompanies, zPrices)
    mlab.outline(vis)
    mlab.orientation_axes(vis)
    #mlab.title('S&P 500 Market Data Visualization', size = .25)
    mlab.axes(vis, nb_labels=0, xlabel = 'Time', ylabel = 'Company', zlabel = 'Price')
    
    #Functionality to be added:
    #    cursor3d = mlab.points3d(0., 0., 0., mode='axes',
    #                                color=(0, 0, 0),
    #                                scale_factor=20)
    #picker = fig.on_mouse_pick(picker_callback)
    
    mlab.show()
开发者ID:mzaccari,项目名称:market-vis,代码行数:33,代码来源:visualization.py


示例11: etsIntro

def etsIntro():
    x, y = np.ogrid[-2:2:20j, -2:2:20j]
    z = x * np.exp( - x**2 - y**2)
    
    pl = mlab.surf(x, y, z, warp_scale="auto")
    mlab.axes(xlabel='x', ylabel='y', zlabel='z')
    mlab.outline(pl)
开发者ID:onehao,项目名称:opensource,代码行数:7,代码来源:mydebug.py


示例12: plot_3D

 def plot_3D( self ):
     x = self.compute3D_plot[0]
     y = self.compute3D_plot[1]
     z = self.compute3D_plot[2]
     # print x_axis, y_axis, z_axis
     if self.autowarp_bool:
         x = x / x[-1]
         y = y / y[-1]
         z = z / z[-1] * self.z_scale
     mlab.surf( x, y , z, representation = 'wireframe' )
     engine = Engine()
     engine.start()
     if len( engine.scenes ) == 75.5:
         engine.new_scene()
         surface = engine.scenes[0].children[0].children[0].children[0].children[0].children[0]
         surface.actor.mapper.scalar_range = np.array( [ 6.97602671, 8.8533387 ] )
         surface.actor.mapper.scalar_visibility = False
         scene = engine.scenes[0]
         scene.scene.background = ( 1.0, 1.0, 1.0 )
         surface.actor.property.specular_color = ( 0.0, 0.0, 0.0 )
         surface.actor.property.diffuse_color = ( 0.0, 0.0, 0.0 )
         surface.actor.property.ambient_color = ( 0.0, 0.0, 0.0 )
         surface.actor.property.color = ( 0.0, 0.0, 0.0 )
         surface.actor.property.line_width = 1.
         scene.scene.isometric_view()
         mlab.xlabel( self.x_name3D )
         mlab.ylabel( self.y_name3D )
     mlab.outline()
     mlab.show()
开发者ID:axelvonderheide,项目名称:scratch,代码行数:29,代码来源:View_Model.py


示例13: plot_mayavi

 def plot_mayavi(self):
     """Use mayavi to plot a phenotype phase plane in 3D.
     The resulting figure will be quick to interact with in real time,
     but might be difficult to save as a vector figure.
     returns: mlab figure object"""
     from mayavi import mlab
     figure = mlab.figure(bgcolor=(1, 1, 1), fgcolor=(0, 0, 0))
     figure.name = "Phenotype Phase Plane"
     max = 10.0
     xmax = self.reaction1_fluxes.max()
     ymax = self.reaction2_fluxes.max()
     zmax = self.growth_rates.max()
     xgrid, ygrid = meshgrid(self.reaction1_fluxes, self.reaction2_fluxes)
     xgrid = xgrid.transpose()
     ygrid = ygrid.transpose()
     xscale = max / xmax
     yscale = max / ymax
     zscale = max / zmax
     mlab.surf(xgrid * xscale, ygrid * yscale, self.growth_rates * zscale,
               representation="wireframe", color=(0, 0, 0), figure=figure)
     mlab.mesh(xgrid * xscale, ygrid * yscale, self.growth_rates * zscale,
               scalars=self.shadow_prices1 + self.shadow_prices2,
               resolution=1, representation="surface", opacity=0.75,
               figure=figure)
     # draw axes
     mlab.outline(extent=(0, max, 0, max, 0, max))
     mlab.axes(opacity=0, ranges=[0, xmax, 0, ymax, 0, zmax])
     mlab.xlabel(self.reaction1_name)
     mlab.ylabel(self.reaction2_name)
     mlab.zlabel("Growth rates")
     return figure
开发者ID:Jhird,项目名称:cobrapy,代码行数:31,代码来源:phenotype_phase_plane.py


示例14: showContour

 def showContour(self):
     """
     Display real space model using contour
     """
     mlab.contour3d(self.array, contours=8, opacity=0.3, transparent=True)
     mlab.outline()
     mlab.show()
开发者ID:wjw12,项目名称:emc,代码行数:7,代码来源:particle.py


示例15: plot_potential_cartesian

    def plot_potential_cartesian(self, fig=None, x=None, y=None, z=None):
        if not self.USE_MAYAVI:
            return None
        if fig is None:
            fig = mlab.figure('Potential')#, bgcolor=(0, 0, 0))
            #fig = mlab.figure('Potential', bgcolor=(0, 0, 0))
        else:
            mlab.figure(fig, bgcolor=fig.scene.background)

        if x is None:
            x = np.linspace(1e-9, 5e-8, num=100, endpoint=True)
        if y is None:
            y = np.linspace(1e-9, 5e-8, num=100, endpoint=True)
        if z is None:
            z = np.linspace(1e-9, 5e-8, num=100, endpoint=True)
        x_grid, y_grid, z_grid = np.meshgrid(x, y, z)
        r_grid, theta_grid, phi_grid = Vectors3D.cartesian_to_spherical(x_grid, y_grid, z_grid)
        volumetric_data = self.potential_on_grid(r_grid, theta_grid, phi_grid)
        #volumetric_data = 1 / (x_grid**2 + y_grid**2 + z_grid**2)
        #mlab.contour3d(x_grid, y_grid, z_grid, volumetric_data, colormap='jet')
        #mlab.contour3d(volumetric_data, colormap='jet')

        source = mlab.pipeline.scalar_field(volumetric_data)
        min = volumetric_data.min()
        max = volumetric_data.max()
        vol = mlab.pipeline.volume(source)
        #vol = mlab.pipeline.volume(source, vmin=min + 0.65 * (max - min),
        #                           vmax=min + 0.9 * (max - min))


        mlab.outline()
        return fig
开发者ID:bond-anton,项目名称:Schottky,代码行数:32,代码来源:Potential_3D.py


示例16: visualizePrices

def visualizePrices(prices):
    '''Creates a mayavi visualization of a pd DataFrame containing stock prices
    Inputs:
    prices => a pd DataFrame, w/ index: dates; columns: company names
    '''
    #Imports mlab here to delay starting of mayavi engine until necessary
    from mayavi import mlab
    
    #Because of current mayavi requirements, replaces dates and company names with integers
    x_length, y_length = prices.shape
    xTime = np.array([list(xrange(x_length)),] * y_length).transpose()
    yCompanies = np.array([list(xrange(y_length)),] * x_length)
    
    #Sort indexed prices by total return on last date
    lastDatePrices = prices.iloc[-1]
    lastDatePrices.sort_values(inplace=True)
    sortOrder = lastDatePrices.index
    zPrices = prices[sortOrder]
    
    #Create mayavi2 object
    fig = mlab.figure(bgcolor=(.4,.4,.4))
    vis = mlab.surf(xTime, yCompanies, zPrices)
    mlab.outline(vis)
    mlab.orientation_axes(vis)
    #mlab.title('S&P 500 Market Data Visualization', size = .25)
    mlab.axes(vis, nb_labels=0, xlabel = 'Time', ylabel = 'Company', zlabel = 'Price')
    
    mlab.show()
开发者ID:ryanpstauffer,项目名称:market-vis,代码行数:28,代码来源:visualization.py


示例17: action

    def action(u, x, xv, y, yv, t, n):
        #print 'action, t=',t,'\nu=',u, '\Nx=',x, '\Ny=', y
        if plot == 1:
            mesh(xv, yv, u, title='t=%g' %t[n])
            time.sleep(0.2) # pause between frames

        elif plot == 2:
            # mayavi plotting
            mlab.clf()
            extent1 = (0, 20, 0, 20,-2, 2)
            s = mlab.surf(x , y, u, colormap='Blues', warp_scale=5,extent=extent1)
            mlab.axes(s, color=(.7, .7, .7), extent=extent1,
            ranges=(0, 10, 0, 10, -1, 1), xlabel='', ylabel='',
            zlabel='',
            x_axis_visibility=False, z_axis_visibility=False)
            mlab.outline(s, color=(0.7, .7, .7), extent=extent1)
            mlab.text(2, -2.5, '', z=-4, width=0.1)
            mlab.colorbar(object=None, title=None, orientation='horizontal', nb_labels=None, nb_colors=None, label_fmt=None)
            mlab.title('test 1D t=%g' % t[n])

            mlab.view(142, -72, 50)
            f = mlab.gcf()
            camera = f.scene.camera
            camera.yaw(0)
        
        
        if plot > 0:
            path = 'Figures_wave2D'
            time.sleep(0) # pause between frames
            if save_plot and plot != 2:
                filename = '%s/%08d.png' % (path, n)
                savefig(filename)  # time consuming!
            elif save_plot and plot == 2:
                filename = '%s/%08d.png' % (path,n)
                mlab.savefig(filename)  # time consuming!
开发者ID:yellowsimulator,项目名称:Blender,代码行数:35,代码来源:wave2D.py


示例18: main_plot3

def main_plot3():
    __import__("matplotlib").rcParams.update({'axes.labelsize': 20,
                                              'axes.titlesize': 20})
    from pylab import plot, show, imshow, figure, colorbar, xlabel, ylabel
    from pylab import legend, title, savefig, close, grid
    from mpl_toolkits.mplot3d import axes3d
    import matplotlib.pyplot as plt
    from matplotlib import cm
    from mayavi import mlab

    names = ['res5.json', 'res24.json', 'res26.json', 'res28.json']
    ps = _load_jsons(names, 'ps')
    ns = _load_jsons(names, 'ns')
    print(len(ps[0]))

    T_fine = r_[0:len(ps) - 1]
    N_fine = r_[:101]
    T_fine, N_fine = np.meshgrid(T_fine, N_fine)

    P_all = array([(array(p[:len(p) // 2]) + p[len(p) // 2:]) for p in ps])
    P_fine = P_all[T_fine, N_fine]
    surf = mlab.mesh(N_fine / (len(N_fine) - 1), P_fine, T_fine / (len(ps) - 1),
                     colormap='blue-red')
    surf.module_manager.scalar_lut_manager.reverse_lut = True

    ax = mlab.axes(xlabel='State (n)', ylabel="Population", zlabel="Time",
                   nb_labels=6, extent=[0, 1, 0, 1, 0, 1],
                   ranges=[0, len(N_fine) - 1, 0, 1, 0, 1])
    ax.label_text_property.font_size = 5

    mlab.outline(surf, color=(.7, .7, .7),
                 extent=[0, 1, 0, 1, 0, 1])
    mlab.show()
开发者ID:yuyichao,项目名称:sideband-cooling,代码行数:33,代码来源:test.py


示例19: plot_mcontour

    def plot_mcontour(self, ndim0, ndim1, z, show_mode):
        "use mayavi.mlab to plot contour."
        if not mayavi_installed:
            self.__logger.info("Mayavi is not installed on your device.")
            return
        #do 2d interpolation
        #get slice object
        s = np.s_[0:ndim0:1, 0:ndim1:1]
        x, y = np.ogrid[s]
        mx, my = np.mgrid[s]
        #use cubic 2d interpolation
        interpfunc = interp2d(x, y, z, kind='cubic')
        newx = np.linspace(0, ndim0, 600)
        newy = np.linspace(0, ndim1, 600)
        newz = interpfunc(newx, newy)
        #mlab
        face = mlab.surf(newx, newy, newz, warp_scale=2)
        mlab.axes(xlabel='x', ylabel='y', zlabel='z')
        mlab.outline(face)
        #save or show
        if show_mode == 'show':
            mlab.show()
        elif show_mode == 'save':
            mlab.savefig('mlab_contour3d.png')
        else:
            raise ValueError('Unrecognized show mode parameter : ' +
                             show_mode)

        return
开发者ID:nickirk,项目名称:VASPy,代码行数:29,代码来源:electro.py


示例20: plot

 def plot(self):
   """Plots the geometry using the package Mayavi."""
   print('\nPlot the three-dimensional geometry ...')
   from mayavi import mlab
   x_init = self.gather_coordinate('x', position='initial')
   y_init = self.gather_coordinate('y', position='initial')
   z_init = self.gather_coordinate('z', position='initial')
   x = self.gather_coordinate('x')
   y = self.gather_coordinate('y')
   z = self.gather_coordinate('z')
   figure = mlab.figure('body', size=(600, 600))
   figure.scene.disable_render = False
   same = (numpy.allclose(x, x_init, rtol=1.0E-06) and
           numpy.allclose(y, y_init, rtol=1.0E-06) and
           numpy.allclose(z, z_init, rtol=1.0E-06))
   if not same:
     mlab.points3d(x_init, y_init, z_init, name='initial',
                   scale_factor=0.01, color=(0, 0, 1))
   mlab.points3d(x, y, z, name='current',
                 scale_factor=0.01, color=(1, 0, 0))
   mlab.axes()
   mlab.orientation_axes()
   mlab.outline()
   figure.scene.disable_render = True
   mlab.show()
开发者ID:Haider-BA,项目名称:snake,代码行数:25,代码来源:geometry.py



注:本文中的mayavi.mlab.outline函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mlab.plot3d函数代码示例发布时间:2022-05-27
下一篇:
Python mlab.mesh函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap