Skip to content

Instantly share code, notes, and snippets.

@rossant
Created December 15, 2014 16:23
Show Gist options
  • Save rossant/bd4292acfd90ca8a2082 to your computer and use it in GitHub Desktop.
Save rossant/bd4292acfd90ca8a2082 to your computer and use it in GitHub Desktop.
VisPy example: interactive cloud of points in 3D
import sys
import numpy as np
from vispy import app, scene
canvas = scene.SceneCanvas(keys='interactive')
view = canvas.central_widget.add_view()
view.set_camera('turntable', mode='perspective', up='z', distance=2,
azimuth=30., elevation=30.)
pos = .25 * np.random.randn(1000, 3)
colors = np.random.uniform(size=(1000, 3), low=.5, high=.8)
p1 = scene.visuals.Markers()
p1.set_data(pos, face_color=colors)
view.add(p1)
if __name__ == '__main__':
canvas.show()
if sys.flags.interactive == 0:
app.run()
@a-jacobo
Copy link

Hi! It's giving me an error saying

File "points.py", line 15, in
p1.set_data(pos, face_color=colors)
"ValueError: color must be of correct shape"

is this an error with vispy? it seems that the color vector has the right size (1000,3)...

Any ideas? thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment