{"id":4227,"library":"pyvista","title":"PyVista","description":"PyVista is a high-level Pythonic interface to the Visualization Toolkit (VTK), simplifying 3D plotting, mesh data structures, and filtering methods for spatial datasets. It is an active project, currently at version 0.47.3, with frequent patch releases and minor versions addressing bugs and introducing new features.","status":"active","version":"0.47.3","language":"en","source_language":"en","source_url":"https://github.com/pyvista/pyvista","tags":["3D visualization","VTK","meshing","plotting","scientific computing"],"install":[{"cmd":"pip install pyvista","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"PyVista directly inherits types from the VTK library, serving as its core 3D visualization backend.","package":"vtk"},{"reason":"Provides the core foundation for PyVista's data array access and manipulation.","package":"numpy"},{"reason":"Used for colormaps and 2D plotting functionalities.","package":"matplotlib"},{"reason":"Used for saving screenshots of plots.","package":"pillow"},{"reason":"Used for reading images and writing animations.","package":"imageio"},{"reason":"Manages the download and caching of example datasets.","package":"pooch"},{"reason":"Provides tools for reporting and debugging the PyVista environment.","package":"scooby"},{"reason":"Used for client and server-side rendering in Jupyter environments.","package":"trame","optional":true},{"reason":"Enables input/output for a wide variety of mesh file formats.","package":"meshio","optional":true}],"imports":[{"note":"The convention is to import PyVista as `pv` for brevity and consistency.","symbol":"pyvista","correct":"import pyvista as pv"},{"note":"Commonly used to access built-in example datasets and functions for quick demonstrations.","symbol":"examples","correct":"from pyvista import examples"}],"quickstart":{"code":"import pyvista as pv\nfrom pyvista import examples\n\n# Download and load an example mesh (e.g., the Stanford dragon)\nmesh = examples.download_dragon()\n\n# Add scalar data based on point coordinates for coloring\nmesh['scalars'] = mesh.points[:, 1]\n\n# Create a plotter and add the mesh\nplotter = pv.Plotter()\nplotter.add_mesh(mesh, cmap='plasma', show_edges=True)\n\n# Set the camera position and display the plot\nplotter.show(cpos='xy')\n","lang":"python","description":"This example demonstrates how to download a sample 3D mesh, assign scalar data to its points for coloring, and then visualize it using PyVista's `Plotter` with a specified colormap and camera position."},"warnings":[{"fix":"To obtain image depth after the plotter closes, you must explicitly enable `store_image_depth=True` in the `show()` method (e.g., `plotter.show(store_image_depth=True)`).","message":"The behavior of `Plotter.show()` regarding image depth storage changed in v0.47. It no longer automatically stores the last image depth.","severity":"breaking","affected_versions":">=0.47.0"},{"fix":"In v0.46.0 and v0.46.1, you had to use `pyvista.set_new_attribute(obj, name, value)`. In v0.46.3+, this was relaxed: new *public* attributes still require `set_new_attribute()`, but *private* attributes (prefixed with `_`) can be set directly.","message":"Setting new attributes on PyVista classes was restricted starting from v0.46.0.","severity":"breaking","affected_versions":"0.46.0 - 0.46.2"},{"fix":"Upgrade to PyVista v0.46.4 or later, which re-enabled the caching mechanism and resolved the performance degradation.","message":"Performance of `mesh.ray_trace` was significantly slower in versions 0.46.0 to 0.46.3 due to the removal of `obbTree` caching.","severity":"gotcha","affected_versions":"0.46.0 - 0.46.3"},{"fix":"Use the `DataSetAttributes.get_array(index)` method instead of the `[]` operator for integer indexing. String-based access (`obj['array_name']`) remains valid.","message":"Accessing arrays in `DataSetAttributes` (e.g., `mesh.point_data` or `mesh.cell_data`) using integer indexing (`obj[index]`) is deprecated.","severity":"deprecated","affected_versions":">=0.32.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}