Skip to content

Commit 72e69a9

Browse files
committed
Fixed plotting with vispy stable (0.4.0)
Previously the code worked only with vispy master
1 parent 5a52502 commit 72e69a9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pyknotid/visualise.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
import random
3131
from colorsys import hsv_to_rgb
3232

33+
try:
34+
from vispy.visuals.transforms import MatrixTransform
35+
except (AttributeError, ImportError):
36+
from vispy.visuals.transforms import AffineTransform as MatrixTransform
37+
3338
vispy_canvas = None
3439

3540
def plot_vispy_cube():
@@ -210,7 +215,7 @@ def plot_line_vispy(points, clf=True, tube_radius=1.,
210215
n.abs(points)))
211216
#canvas.view.camera = scene.TurntableCamera(fov=30)
212217
if zero_centroid:
213-
l.transform = scene.transforms.MatrixTransform()
218+
l.transform = MatrixTransform()
214219
# l.transform = scene.transforms.AffineTransform()
215220
l.transform.translate(-1*n.average(points, axis=0))
216221

@@ -255,7 +260,7 @@ def plot_lines_vispy(lines, clf=True, tube_radius=1.,
255260
# points, axis=0)))
256261

257262
if zero_centroid:
258-
l.transform = scene.transforms.MatrixTransform()
263+
l.transform = MatrixTransform()
259264
# l.transform = scene.transforms.AffineTransform()
260265
l.transform.translate(-1*n.average(points, axis=0))
261266

0 commit comments

Comments
 (0)