Created
December 15, 2014 16:23
-
-
Save rossant/bd4292acfd90ca8a2082 to your computer and use it in GitHub Desktop.
VisPy example: interactive cloud of points in 3D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!