I'm tryng to create a barchart using Vispy since im tended to use opengl cause of a large set of data.
From the vispy docs i found the visuals.Rectangle class which provides me a "bar". Unfortunately the class takes only 1 set of points so i tried to create multiple rectangles within a loop. At this point, the plot already slow down at a few rectangles, 100-1000 is already really bad. Obviously thats the wrong way to create the chart which brings me here. How can i create multiple rectangle without adding every rectangle separatley?
Heres a snippet:
import sys
import numpy as np
from vispy import scene, app
canvas = scene.SceneCanvas(keys='interactive')
canvas.size = 600, 600
canvas.show()
grid = canvas.central_widget.add_grid()
view = grid.add_view(row=0, col=0)
view.camera = scene.PanZoomCamera(rect=(-1,-1,10,10))
for i in range(10):
rec = scene.visuals.Rectangle(center=(i, i), height=1, width=0.5, color='r')
view.add(rec)
gl = scene.visuals.GridLines(parent=view.scene)
if __name__ == '__main__' and sys.flags.interactive == 0:
app.run()