Skip to content Skip to sidebar Skip to footer

How To Plot In Real Time With Vispy Library?

I wrote a script for modeling the evolution of a pandemic (with graphs and scatter plots). I tried several libraries to display results in real-time (8 countries x 500 particles):

Solution 1:

We can efficiently plot in real time by using vispy.gloo module to leverage the power of GPU. Here is one way of doing it :

1) Build a class that inherits vispy.app.Canvas class.

2) Create an OpenGL Program whose inputs are shaders. This object allows us to link our data to shader variables. Each dot on the canvas depends on these variable values (describing its coordinate, color, etc). For example, it is way harder for displaying text (titles, labels, etc) than with Matplotlib library. Here is a deeper explanation of the process.

3) Set a timer connected to the function we want to call repeatedly (real-time side).

The vispy.scene module, dedicated to the high-level visualization interfaces for scientists, is still experimental. Maybe this is the reason why my first code got some bugs.

Here is my new code.

Post a Comment for "How To Plot In Real Time With Vispy Library?"