API Reference#
In this section, you can learn more about how PyVista wraps different VTK mesh types and how you can leverage powerful 3D plotting and mesh analysis tools. Highlights of the API include:
Pythonic interface to VTK’s Python bindings
Filtering/plotting tools built for interactivity (see Widgets)
Direct access to common VTK filters (see Filters)
Intuitive plotting routines with matplotlib similar syntax (see Plotting)
Learn more about PyVista’s different mesh types and direct access to common VTK filters.
>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> sliced = mesh.slice()
>>> sliced.length
1.409317132047406
Explore PyVista’s robust plotting interface for visualizing the core data structures.
>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(mesh, scalars=mesh.points)
>>> actor.prop
Property (0x7f0f10de9900)
Ambient: 0.0
Ambient color: Color(name='lightblue', hex='#add8e6ff', opacity=255)
Anisotropy: 0.0
Color: Color(name='lightblue', hex='#add8e6ff', opacity=255)
Culling: "none"
Diffuse: 1.0
Diffuse color: Color(name='lightblue', hex='#add8e6ff', opacity=255)
Edge color: Color(name='black', hex='#000000ff', opacity=255)
Edge opacity: 1.0
Interpolation: InterpolationType.FLAT
Lighting: True
Line width: 1.0
Metallic: 0.0
Opacity: 1.0
Point size: 5.0
Render lines as tubes: False
Render points as spheres: False
Roughness: 0.5
Show edges: False
Specular: 0.0
Specular color: Color(name='lightblue', hex='#add8e6ff', opacity=255)
Specular power: 100.0
Style: "Surface"
Use PyVista’s Reader classes to read data files using
pyvista.get_reader()
.
>>> import pyvista as pv
>>> from pyvista import examples
>>> reader = pv.get_reader(examples.hexbeamfile)
>>> reader
VTKDataSetReader('/home/runner/work/pyvista/pyvista/pyvista/examples/hexbeam.vtk')
Utilize PyVista’s helper modules, conversion tools, and geometric object creation routines.
>>> import pyvista as pv
>>> mesh = pv.ParametricSuperEllipsoid(xradius=0.1)
>>> mesh
Header | Data Arrays | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|