Mayavi Mlab基础教程:交互式数据可视化与3D图形

需积分: 28 66 下载量 15 浏览量 更新于2024-07-23 3 收藏 2.69MB PDF 举报
本教程是关于Mayavi Mlab的简明PPT指南,由Prabhu Ramachandran和Gaël Varoquaux撰写。Mayavi是一个基于Python的强大3D数据可视化库,它结合了Matplotlib的简单性和VTK的高级功能。本教程旨在为初学者提供一个快速入门,通过实例展示如何在Mayavi环境中进行交互式编程,并利用其丰富的plotting functions来处理各种类型的三维数据。 首先,教程从介绍Mayavi的基本概念开始,强调使用`from enthought.mayavi import mlab`导入模块,以便在交互式IPython环境中工作。作者指出,对于简单的任务,应该优先考虑简洁的解决方案,同时提及在Mayavi中,工作通常基于NumPy数组,因为它是Python科学计算的基础库。 在讲解实际操作部分,教程详细介绍了如何处理不同维度的数据。例如: 1. 对于0D(点)数据,可以使用`mlab.points3d()`绘制点云。 2. 1D数据可通过`mlab.plot3d()`创建线性路径。 3. 2D数据则使用`mlab.surf()`或`mlab.mesh()`绘制等高线图或网格表面。 4. 对于3D数据,可以使用`mlab.contour3d()`创建等值面和`mlab.quiver3d()`表示向量场。 此外,教程还提到每个plotting function都有相应的测试或演示示例,以便用户了解它们的实际效果。例如,`mlab.surf`和`mlab.mesh`之间的区别在于前者提供类似地毯图的图像效果,而后者则是基于正交网格但允许更自由的形状。 为了使可视化更具吸引力,教程展示了如何添加标题、颜色条以及调整轴、轮廓线和文本等元素。此外,关键知识点之一是理解`extents`参数,它在Mayavi中对应于数据的范围,可以通过数据的自然边界来设置图形的显示区域。 最后,PPT教程总结了如何利用众多可定制的keyword arguments进一步美化和控制绘图效果,使用户能够根据具体需求调整图形细节。 这个Mayavi Mlab简明教程是一份实用的指南,涵盖了从基础操作到高级定制的各个方面,帮助用户熟练掌握这个强大的3D数据可视化工具。无论是科研、教学还是数据分析,它都是学习者快速上手Mayavi的重要资源。
876 浏览量
Mayavi 的参考手册,适合初学者和expert。 User guide: full table of contents An overview of Mayavi Introduction What is Mayavi2? Technical details Using Mayavi as an application, or a library? Scenes, data sources, and visualization modules: the pipeline model Loading data into Mayavi Installation Installing ready-made distributions Requirements for manual installs Doing it yourself: Python packages: Eggs Installing with easy_install Step-by-step instructions to install with eggs under Windows Under Mac OSX Snow Leopard The bleeding edge: Git Testing your installation Troubleshooting Using the Mayavi application Tutorial examples to learn Mayavi Parametric surfaces: a simple introduction to visualization Loading scalar data: the heart.vtk example Visualizing rich datasets: the fire_ug.vtu example Using Mayavi with scipy Exploring a vector field General layout of UI Visualizing data Modules Filters Interaction with the scene Mouse interaction Keyboard interaction From interactive usage to scripting The embedded Python interpreter Recording Mayavi actions to a script Command line arguments mlab: Python scripting for 3D plotting A demo 3D Plotting functions for numpy arrays 0D and 1D data 2D data 3D data Changing the looks of the visual objects created Adding color or size variations Changing the scale and position of objects Changing object properties interactively Figures, legends, camera and decorations Handling several figures Figure decorations Moving the camera Running mlab scripts Using mlab interactively Using together with Matplotlib’s pylab In scripts Animating the data Assembling pipelines with mlab Data sources Modules and filters Case studies of some visualizations Visualizing volumetric scalar data Visualizing a vector field Advanced use of Mayavi Organisation of Mayavi visualizations: the pipeline Anatomy of a Mayavi pipeline The link between different Mayavi entry points A pipeline example examined Data representation in Mayavi Introduction to TVTK datasets The flow of data Retrieving the data from Mayavi pipelines Dissection of the different TVTK datasets Inserting TVTK datasets in the Mayavi pipeline Objects populating the Mayavi pipeline Scene Source Filter ModuleManager: Colors and legends node Module Engine Base class: PipelineBase Class hierarchy Advanced Scripting with Mayavi Design Overview: Mayavi as a visualization framework Scripting the mayavi2 application Using the Mayavi envisage plugins Building applications using Mayavi Custom interactive dialogs Embedding a Mayavi scene in a Traits dialog A scene, with mlab embedded Making the visualization live Integrating in a WxPython application Integrating in a Qt application Tips and Tricks Off screen rendering Avoiding the rendering window Platform Summary Rendering using the virtual framebuffer Using VTK with Mesa for pure software rendering Extending Mayavi with customizations Customizing Mayavi2 Scripting Mayavi without using Envisage Computing in a thread Polling a file and auto-updating Mayavi Serving Mayavi on the network TCP server: the serve_tcp function UDP server: the serve_udp function Animating a visualization Animating a series of images Making movies from a stack of images Scripting from the command line Texture mapping actors Shifting data and plotting Using the UserDefined filter Sharing the same data between scenes Using mlab Using the core Mayavi API Changing the interaction with a scene Accelerating a Mayavi script Miscellaneous Citing Mayavi Getting help Tests for Mayavi Helping out Development quick start Improving the documentation Example gallery Mlab functions gallery Advanced mlab examples Interactive examples Advanced visualization examples Data interaction examples Misc examples MLab reference Plotting functions barchart contour3d contour_surf flow imshow mesh plot3d points3d quiver3d surf triangular_mesh Figure handling functions clf close draw figure gcf savefig screenshot sync_camera Figure decoration functions colorbar scalarbar vectorbar xlabel ylabel zlabel Camera handling functions move pitch roll view yaw Other functions animate axes get_engine orientation_axes outline set_engine show show_engine show_pipeline start_recording stop_recording text text3d title Mlab pipeline-control reference Sources Tools Data Modules and Filters Mayavi API reference Pipeline base objects Scene Source Filter ModuleManager Module PipelineBase Engine Main view and UI objects Scene UIs: DecoratedScene and MayaviScene SceneEditor MlabSceneModel EngineView and EngineRichView Known bugs and issues Changelog Mayavi 3.4.0 (Oct 15, 2010) Enhancements Fixes Mayavi 3.3.2 (May 25, 2010) Enhancements Fixes Mayavi 3.3.1 (Feb 24, 2010) Enhancements Fixes Mayavi 3.3.0 (July 15, 2009) Enhancements Fixes Mayavi 3.2.0 (March 23, 2009) Mayavi 3.1.0 Mayavi 3.0.3 Mayavi 3.0.1 and 3.0.2 Mayavi 3.0.0