Vispy Python Graphics: Difference between revisions

From wikiluntti
 
(One intermediate revision by the same user not shown)
Line 35: Line 35:
plotwidget = fig[0, 0]
plotwidget = fig[0, 0]
fig.title = "Line Plot"
fig.title = "Line Plot"
plotwidget.plot([(x, x**2) for x in range(0, 100)], title="y = x²")
plotwidget.plot( [[0,0], [100, 10000]], width=3, color=(0.8, 0, 0.7, .2) )
plotwidget.plot([(x, x**2) for x in range(0, 100)], title="y = x²", color='y')
plotwidget.colorbar(position="top", cmap="spring")
plotwidget.colorbar(position="top", cmap="spring")



Latest revision as of 13:22, 14 April 2025

Introduction

VIspy; Python; high-performance interactive 2D/3D data visualization library. VisPy leverages the computational power of modern Graphics Processing Units (GPUs) through the OpenGL library to display very large datasets.

Installation

Install using many methods: here is pip. Include PyQT5.

Also you can also install VisPy from Test PyPI, a separate instance of the Python Package Index that allows you to try distribution tools and processes without affecting the real index.

pip install vispy
pip install PyQt5
pip install --index-url <https://test.pypi.org/simple/> vispy

Test and check the GL version using test() command.

import vispy
vispy.test()

Simple programs

Dots

Uniocode generator https://lingojam.com/SuperscriptGenerator

import vispy.plot as vp
fig = vp.Fig(size=(600, 500), show=False)

plotwidget = fig[0, 0]
fig.title = "Line Plot"
plotwidget.plot( [[0,0], [100, 10000]], width=3, color=(0.8, 0, 0.7, .2) )
plotwidget.plot([(x, x**2) for x in range(0, 100)], title="y = x²", color='y')
plotwidget.colorbar(position="top", cmap="spring")

fig.show(run=True)

2

3

4

5

6