Skip to content

Slicing for 3D volume does not work #414

Open

Description

@PetrDvoracek

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?

Activity

  1. JBartrand commented on Oct 28, 2022

    @JBartrand

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions