vedo
vedo copied to clipboard
Axis disappear when using multiple plots
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:
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:
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?
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()
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