marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.04k stars 265 forks source link

I wonder about plt.show() #863

Closed jamja11 closed 1 year ago

jamja11 commented 1 year ago

Hello, Thank you for your effort. I'm so curious about plt.show()

plt = vedo.Plotter()
plt.add(vedo.load(vedo.dataurl+'shark.ply').c('cyan'))
plt.show(viewup=[0,100,-1])
plt.look_at(plane='xy').show()
plt.show(viewup=[0,100,-1])  # no change

Why are the second and last results the same?

I ran the first line and rotated it. And in the second line, it was rotated again based on the xy plane. finally, I expected the same result as the first line, but it was not. Why?

I want to use show(view up=[0, 100, -1]) multiple times not only once.

marcomusy commented 1 year ago

Hi thanks for reporting, originally this was an intended behavior but I understand it's counterintuitive so I going to flag it as bug and see if I can rethink the API.. In principle you should call show() only once and then call render() in either loops or callback functions to update the scene, eg:

import vedo
plt = vedo.Plotter()

plt.add(vedo.load(vedo.dataurl+'shark.ply'))
plt.show(viewup=[0,100,-1], axes=1)

plt.look_at(plane='xy').render()
plt.interactive()

plt.look_at(plane='xz').render()
plt.interactive()
jamja11 commented 1 year ago

Thank you for your prompt reply. I solved it another way.

plt.look_at(plane='xy').show() # anterior plt.look_at(plane='zy').show(roll=90) # left plt.look_at(plane='xz').show(axes=1, roll=-90, azimuth=-90) # right