VisPy

0.16.1 · active · verified Tue Apr 14

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.

Warnings

Install

Imports

Quickstart

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.

import sys
import numpy as np
from vispy import scene, app
from vispy.color import Color

# Create a canvas
canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
canvas.title = "VisPy Cube"

# Create a viewbox
view = canvas.central_widget.add_view()
view.camera = 'turntable' # For 3D interaction

# Create a cube visual and add to the view
cube_mesh = scene.visuals.Cube()
view.add(cube_mesh)

# Set background color
view.bgcolor = Color('black')

# Start the event loop
if __name__ == '__main__':
    print("VisPy window opened. Close it to exit.")
    app.run()

view raw JSON →