VisPy is a high-performance interactive 2D/3D data visualization library in Python. It leverages the computational power of modern Graphics Processing Units (GPUs) through OpenGL to display very large datasets and facilitate real-time data visualization. Currently at version 0.16.1, the library is under active development with a roadmap towards a 1.0 release, focusing on stability, performance, and higher-level interfaces for ease of use.
pip install vispyVerified import paths — ran on the pinned version, not inferred.
This example creates a simple interactive 3D cube using VisPy's high-level scene graph interface. It demonstrates how to initialize a canvas, set up a 3D camera, add a visual object, and run the VisPy application event loop.
Ensure a compatible GUI toolkit (e.g., `pip install PyQt5`) and the latest GPU drivers are installed.
Combine multiple graphical elements into a single `Visual` where possible (e.g., one `LineVisual` to draw multiple lines instead of many `LineVisuals`). For complex cases, consider custom visuals with optimized shader code.
Ensure all drawing and update calls that interact directly with the OpenGL context or VisPy Canvas are executed on the main GUI thread. Use thread-safe mechanisms provided by the GUI backend (e.g., signals/slots in Qt) for inter-thread communication.
Pin `vispy` to an exact version in `requirements.txt` to prevent unexpected breaking changes. Review release notes carefully when upgrading.
For new projects or refactoring, prioritize using the `vispy.scene` and `vispy.plot` high-level interfaces. If `gloo` is necessary, be aware of its potential deprecation and future replacement strategies.