Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slicing for 3D volume does not work #414

Open
PetrDvoracek opened this issue Aug 19, 2022 · 1 comment
Open

Slicing for 3D volume does not work #414

PetrDvoracek opened this issue Aug 19, 2022 · 1 comment

Comments

@PetrDvoracek
Copy link

Versions

python 3.8.12
ipyvolume 0.6.0a10

Problem

I followed the tutorial to create slices in 3d volume https://ipyvolume.readthedocs.io/en/latest/examples/slice.html. First I show show the volume with

import ipyvolume as ipv
fig = ipv.figure()
scatter = ipv.examples.gaussian(show=False)
ipv.show()

then I try to add the slice planes with

plane = ipv.plot_plane("z");

but I got an error instead

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
Input In [71], in <cell line: 1>()
----> 1 plane = ipv.plot_plane("x")

File ~/anaconda3/envs/mozek/lib/python3.8/site-packages/ipyvolume/pylab.py:1113, in plot_plane(where, texture)
   1111     u = [0., 1., 1., 0.]
   1112     v = [0., 0., 1., 1.]
-> 1113 mesh = plot_trisurf(x, y, z, triangles, texture=texture, u=u, v=v)
   1114 return mesh

UnboundLocalError: local variable 'x' referenced before assignment

Do you have any idea why the slicing tutorial is not reproducible in my environment?

@JBartrand
Copy link

It appears there was a major update to the plot_plane function such that the 'where' options were changed from {'x', 'y','z'} to {'front', 'back', 'left', 'right', 'top', 'bottom'}. If you change the plot_plane argument to "top", you will solve this error, but other errors will arise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants