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

Axis disappear when using multiple plots #1201

Open
leon-vv opened this issue Nov 20, 2024 · 2 comments
Open

Axis disappear when using multiple plots #1201

leon-vv opened this issue Nov 20, 2024 · 2 comments
Labels

Comments

@leon-vv
Copy link

leon-vv commented Nov 20, 2024

Hi!

First of all thanks for creating this great piece of software!

I encountered some behavior which might be a bug. Please consider the code and the screenshots below

Case 1

from vedo import *

plt1 = Plotter(axes=1)
plt1 += Cone()
plt1.show()

plt2 = Plotter(axes=1)
plt2 += Cone()
plt2.show()

Both plots come out correctly as follows:
Screenshot from 2024-11-20 21-59-04

Case 2

from vedo import *

plt1 = plotter(axes=1)
plt1 += cone()

plt2 = plotter(axes=1)
plt2 += cone()

plt1.show()
plt2.show()

In the second case the first plot loses its axis:
Screenshot from 2024-11-20 22-01-57

I had expected the two plotters to be independent. But this does not appear to be the case, which means that the placement of the .show() call matters. Is this a bug?

@marcomusy marcomusy added the bug label Nov 20, 2024
@marcomusy
Copy link
Owner

Hi Leon, thanks for reporting, it looks indeed a bug..
Possible workarounds:

# import vedo
# from vedo import *

# plt1 = Plotter(axes=1)
# plt1 += Cone()

# plt2 = Plotter(axes=1)
# plt2 += Cone()

# plt2.show()
# vedo.plotter_instance = plt1
# plt1.show()


from vedo import *

plt1 = Plotter(interactive=0)
cone1 = Cone().c("red4")
plt1 += [cone1, Axes(cone1)]

plt2 = Plotter(interactive=0, pos=(1000,0))
cone2 = Cone().rotate_y(60).pos([3,2,1])
plt2 += [cone2, Axes(cone2)]

plt1.show()
plt2.show()
plt2.interactive()
Screenshot 2024-11-21 at 00 06 14

@leon-vv
Copy link
Author

leon-vv commented Nov 21, 2024

Hi @marcomusy, thanks for letting me know it's indeed a bug. I was able to work around this in my library (https://github.com/leon-vv/Traceon) by 'buffering' the elements to be plotted and only add them to the Plotter just before calling .show(). Thanks anyways for maintaining this piece of software

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

No branches or pull requests

2 participants