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

Not able to re-size x, y, z arrays for surface #286

Open
nvaytet opened this issue Dec 6, 2019 · 0 comments
Open

Not able to re-size x, y, z arrays for surface #286

nvaytet opened this issue Dec 6, 2019 · 0 comments

Comments

@nvaytet
Copy link

nvaytet commented Dec 6, 2019

It does not seem possible to replace the data fields (x, y, z) of existing surface/wireframe with new arrays that have different shapes.

Example:

import ipyvolume as ipv
import numpy as np
a = np.arange(-5, 5)
x, y = np.meshgrid(a, a)
z = np.ones_like(x) * 0.5

fig = ipv.figure()
surf = ipv.plot_surface(x, z, y, color="orange")
wfrm = ipv.plot_wireframe(x, z, y, color="red")
fig.xlim = [-10, 10]
fig.zlim = [-10, 10]
ipv.show()

Screenshot at 2019-12-06 22-26-14

b = np.arange(-5, 9)
x2, y2 = np.meshgrid(b, b)
z2 = np.ones_like(x2) * 0.5
wfrm.x = x2
wfrm.y = y2
wfrm.z = z2

Screenshot at 2019-12-06 22-25-47

But replotting a whole new figure seems to work:

fig = ipv.figure()
surf = ipv.plot_surface(x, z, y, color="orange")
wfrm = ipv.plot_wireframe(x2, z2, y2, color="red")
fig.xlim = [-10, 10]
fig.zlim = [-10, 10]
ipv.show()

Screenshot at 2019-12-06 22-38-49

Alternatively, is it possible to remove a surface from a figure? I know one can set

fig.meshes = []

to clear the figure, but this only shows after a new call to ipv.gcc(). The surface is not removed in the surface is not removed in the original figure (#71 (comment)).

Thanks for any help! :-)

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

1 participant