MAYAVI2(1)
MAYAVI2 πβ¨
okay bestie, welcome to the manual for mayavi2, a General Commands Manual classic and honestly? a whole vibe. it's giving "science but make it pretty." let's get into it π¦
NAME π
mayavi2 β a scientific visualization package for 2-D and 3-D data. yes. literally that. she visualizes your science. iconic behavior.
SYNOPSIS β¨
mayavi2 [options] [args]
so where do arg1, arg2, etc. come in? those are optional file names, and they correspond to:
- saved Mayavi2 visualizations (
filename.mv2) - Mayavi2 scripts (
filename.py) - any data file formats that Mayavi supports
basically you can just hand her a file and she'll know what to do with it. main character energy fr fr π
DESCRIPTION πΈ
Mayavi2 is a tool for 2-D and 3-D scientific visualization. and the features? oh we're listing them, bestie. features of Mayavi2 include:
- Visualization of scalar and vector data in 2 and 3 dimensions
- Easy scriptability using Python
- Easy extendability via sources, components, modules, and data filters
- Reading several file formats: VTK (legacy and XML), PLOT3D, etc.
- Saving of visualizations
- Saving rendered visualization in a variety of image formats.
like. scriptable, extendable, reads everything, saves everything. she does it ALL no cap π
OPTIONS π
every single flag, right here, in order, no skips, we're not doing that:
-hβ prints all the available command line options and exits. also available through--help.-Vβ prints the Mayavi version on the command line and exits. also available through--version.-z filename.mv2β loads a previously saved Mayavi2 visualization. also available through--viz filename.mv2or--visualization filename.mv2.-d datafile.*β opens any of the supported data file formats, or a non-file related data source. this includes VTK file formats (*.vtk,*.xml,*.vt[i,p,r,s,u],*.pvt[i,p,r,s,u]), VRML2 (*.wrl), 3D Studio (*.3ds), PLOT3D (*.xyz), STL, BYU, RAW, PLY, PDB, SLC, FACET, OBJ, AVSUCD (*.inp), GAMBIT (*.neu), Exodus (*.exii), PNG, JPEG, BMP, PNM, DCM, DEM, MHA, MHD, MINC, XIMG, TIFF, and various others that are supported.datafile.*can also be a source object that is not associated with a file β for exampleParametricSurfaceorPointLoadwill load the corresponding data sources into Mayavi. also available through--data.-m module-nameβ a module is an object that actually visualizes the data. the given module-name is loaded in the currentModuleManager. the module name must be a valid one β if not, you will get an error message.
if a module is specified as 'package.sub.module.SomeModule' then the module (SomeModule) is imported from 'package.sub.module'. standard modules provided with mayavi2 do not need the full path specification. for example:
mayavi2 -d data.vtk -m Outline -m m2_user_modules.TestModule
in this example 'Outline' is a standard module and 'm2_user_modules.TestModule' is some user defined module. see the MAYAVI2 MODULES section below for an exhaustive list of available modules. also available through --module.
-f filter-nameβ a filter is an object that filters out the data in some way or the other. the given filter-name is loaded with respect to the current source/filter object. the filter name must be a valid one β if not you will get an error message.
if the filter is specified as 'package.sub.filter.SomeFilter' then the filter (SomeFilter) is imported from 'package.sub.filter'. standard modules provided with mayavi2 do not need the full path specification. for example:
mayavi2 -d data.vtk -f ExtractVectorNorm -f
m2_user_filters.TestFilter
in this example 'ExtractVectorNorm' is a standard filter and 'm2_user_filters.TestFilter' is some user defined filter.
see the MAYAVI2 FILTERS section below for an exhaustive list of available filters. also available through --filter.
-Mβ starts up a new module manager on the Mayavi pipeline. also available through--module-mgr.-nβ creates a new window/scene. any options passed after this will apply to this newly created scene. also available through--new-window.-tβ runs the mayavi2 test suite and exits. if run as such, this runs both the TVTK and Mayavi2 unittests. if any additional arguments are passed, they are passed along to the test runner. so this may be used to run other tests as well. for example:
mayavi2 -t enthought.persistence
this will run just the tests inside the enthought.persistence package. you can also specify a directory with test files to run with this, for example:
mayavi2 -t relative_path_to/integrationtests/mayavi
will run the integration tests from the mayavi sources. also available through --test.
-x script-fileβ executes the given script in a namespace where we guarantee that the name'mayavi'is Mayavi's script instance β just like in the embedded Python interpreter. also available through--exec.
β οΈ WARNING: note that this uses execfile, so please note that this can be dangerous if the script does something nasty! π
-s python-expressionβ executes the expression on the last created object. for example, if the previous object was a module, and we want to set the color of that object, one can do-s "actor.property.color = (1,0,0)". one should use quotes for the expression. also available with--set. for example:
mayavi2 -d ParametricSurface -m Outline \
-s "actor.property.color = (1,0,0)" \
-s "scene.save('test.png', size=(800, 800))"
β οΈ WARNING: note that this uses exec, so please note that this can be dangerous! π
MAYAVI2 MODULES π
here's the full roster, bestie. every single one. she has RANGE:
Axesβ draws simple axes.ContourGridPlaneβ a contour grid plane module. this module lets one take a slice of input grid data and view contours of the data.CustomGridPlaneβ a custom grid plane with a lot more flexibility than theGridPlanemodule.DataSetClipperβ this filter clips the dataset in a area. the area can be defined interactively as a box, a sphere...Glyphβ displays different types of glyphs oriented and colored as per scalar or vector data at the input points.GridPlaneβ a simple grid plane module.HyperStreamlineβ a module that integrates through a tensor field to generate a hyperstreamline. the integration is along the maximum eigenvector and the cross section of the hyperstreamline is defined by the two other eigenvectors. thus the shape of the hyperstreamline is"tube-like", with the cross section being elliptical. hyperstreamlines are used to visualize tensor fields.ImageActorβ a simple module to view image data efficiently.ImagePlaneWidgetβ a simple module to view image data.IsoSurfaceβ a module that allows the user to make contours of input point data.Labelsβ allows a user to label the current dataset or the current actor of the active module.OrientationAxesβ creates a small axes on the side that indicates the position of the co-ordinate axes and thereby marks the orientation of the scene. requires VTK-4.5 and above.Outlineβ a module that draws an outline for the given data.ScalarCutPlaneβ takes a cut plane of any input data set using an implicit plane and plots the data with optional contouring and scalar warping.SliceUnstructuredGridβ this module takes a slice of the unstructured grid data and shows the cells that intersect or touch the slice.Streamlineβ allows the user to draw streamlines for given vector data. this supports various types of seed objects (line, sphere, plane and point seeds). it also allows the user to draw ribbons or tubes and further supports different types of interactive modes of calculating the streamlines.StructuredGridOutlineβ draws a grid-conforming outline for structured grids.Surfaceβ draws a surface for any input dataset with optional contouring.TensorGlyphβ displays tensor glyphs oriented and colored as per scalar or vector data at the input points.Textβ this module allows the user to place text on the screen.VectorCutPlaneβ takes an arbitrary slice of the input data using an implicit cut plane and places glyphs according to the vector field data. the glyphs may be colored using either the vector magnitude or the scalar attributes.Vectorsβ displays different types of glyphs oriented and colored as per vector data at the input points. this is merely a convenience module that is entirely based on theGlyphmodule.Volumeβ the Volume module visualizes scalar fields using volumetric visualization techniques.WarpVectorCutPlaneβ takes an arbitrary slice of the input data using an implicit cut plane and warps it according to the vector field data. the scalars are displayed on the warped surface as colors.
and that's the modules, bestie π more coming, don't you dare close the tab π«Ά
π MAYAVI2 FILTERS π
okay bestie, this is the good part β the filters π
. these are the lil' gizmos you bolt onto your pipeline with -f, or clicky-click in the GUI, to bend your data into whatever shape your heart desires. here's the whole roster, no cap:
CellDerivativesβ takes your input point scalar and vector data, does the derivative thing, and hands you back cell data all about the gradients. want an approximate vorticity? this is giving exactly that β¨CellToPointDataβ flips cell attribute data into point data by averaging the cell data from all the cells hanging out at that point π«ΆContourβ a contour filter that wraps around theContourcomponent, so you get iso-surfaces on literally any input dataset. iconic.CutPlaneβ a cut plane you can slice through any dataset with πͺ and it also brings a 3D widget interface so you can position and move the slice interactively. main character energy.ElevationFilterβ makes scalar data that corresponds to the elevation of the points along a line β°οΈDelaunay2Dβ 2D Delaunay triangulation, periodt.Delaunay3Dβ same vibe, but in 3D β¨ExtractEdgesβ pulls the cell edges out of any input data.ExtractGridβ lets you select just a part of a structured grid. choosey queen πExtractTensorComponentsβ wraps the TVTKExtractTensorComponentsfilter so you can extract components from a tensor field.ExtractUnstructuredGridβ lets you select a part of an unstructured grid.ExtractVectorNormβ computes the norm (Euclidean) of your input vector data, with optional scaling between[0, 1]. super useful when the input data has vector input but no scalar data for the magnitude of the vectors β like, where else are you gonna get it πExtractVectorComponentsβ wraps the TVTKExtractVectorComponentsfilter to extract components of a vector. perfect for analysing individual components of vector data one at a time π¦GaussianSplatterβ splats your points into a volume with an elliptical, Gaussian distribution. splat π₯MaskPointsβ selectively passes the input points downstream, which is how you subsample your points.
β οΈ heads up bestie: this does not pass geometry data. that means all grid information is lost. like, poof π
GreedyTerrainDecimationβ approximates a height field (image data) with a triangle mesh while keeping the number of triangles at a minimum. frugal and gorgeous πΈImageChangeInformationβ changes the origin, spacing and extents of an input image dataset without changing the data itself. glow-up with zero side effects β¨ImageDataProbeβ probes any dataset using a Structured Points dataset. it also lets you convert the scalar data to anunsigned shortarray so those scalars can be used for volume visualization πPointToCellDataβ does the inverse of theCellToPointDatafilter. exactly what it says on the tin πPolyDataNormalsβ computes normals from input data, which gives meshes a smoother appearance. should work for any input dataset.
π note: in the Mayavi2 GUI this one is called "Compute Normals" (Visualize/Filters/Compute Normals). yes, same filter, different name, it's giving alias π
QuadricDecimationβ reduces the triangles in a mesh and still forms a good approximation of the original mesh. less is more, periodt.SelectOutputβ lets you select one among several of the outputs of a given input. typically super useful for a multi-block data source, fr fr.SetActiveAttributeβ lets you set the active data attribute (scalars, vectors and tensors) on a VTK dataset. especially useful if you need to do something like compute contours of one scalar on the contour of another scalar. nesting dolls but make it science πͺStripperβ creates triangle strips and/or poly-lines. great for regularizing broken up surfaces, such as those created by theTubefilter.Thresholdβ a simple filter that thresholds on input data. simple, effective, iconic.TransformDataβ performs a linear transformation to input data πTriangleFilterβ converts input polygons and triangle strips to triangles using thetvtk.TriangleFilterclass. you want this when you've got a downstream filter that only processes triangles and nothing else πTubeβ turns lines into tubes. that's it. that's the filter π§UserDefinedβ lets you define your own filter dynamically/interactively. it's likeFilterBasebut it allows you to specify the class without writing any code. DIY queen πVorticityβ computes the vorticity of an input vector field. for convenience, the filter lets you optionally pass-through the given input vector field, and it also lets you show the component of the vorticity along a particular cartesian co-ordinate axes. it produces point data on output which is ready to visualize πWarpScalarβ warps the input data along a particular direction (either the normals or a direction you specify) with a scale specified by the local scalar value. carpet plots, bestie π§ΆWarpVectorβ warps the input data along the point vector attribute, scaled as per a scale factor. perfect for showing flow profiles or displacements π«
β¨ EXAMPLES β¨
here's the vibe in action, copy-paste away:
mayavi2 -d heart.vtk -m Axes -m Outline -m GridPlane -m ContourGridPlane -m IsoSurface
mayavi2 -d fire_ug.vtu -m Axes -m Outline -m VectorCutPlane -f MaskPoints -m Glyph
In the above examples, heart.vti and fire_ug.vtu VTK files can be found in /usr/share/doc/mayavi2/examples/data. The examples directory (/usr/share/doc/mayavi2/examples/ on Debian) provides several useful examples π
π AUTHOR π
Mayavi was originally developed by Prabhu Ramachandran. Many people have later contributed to it. legends only π«Ά
More information on Mayavi2 can be obtained from http://code.enthought.com/mayavi2
and that's the whole page, bestie! this is the MAYAVI2(1) manual page β section 1 of the manual, the one and only β so go forth and render something absolutely gorgeous. slay π
β¨π
π¦ where this page comes from
- debian bookworm: mayavi2 4.8.0-2
- fedora 43: Mayavi 4.8.3-3.fc43 Β· LicenseRef-Callaway-BSD AND LicenseRef-Callaway-EPL AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-LGPLv2 AND LGPL-3.0-only
- fedora 44: Mayavi 4.8.3-2.fc44 Β· LicenseRef-Callaway-BSD AND LicenseRef-Callaway-EPL AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-LGPLv2 AND LGPL-3.0-only
- ubuntu jammy: mayavi2 4.7.1-3ubuntu1
- ubuntu noble: mayavi2 4.8.1-3build1
- ubuntu questing: mayavi2 4.8.3-1
- ubuntu stonking: mayavi2 4.9.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms