ipyvolume
ipyvolume copied to clipboard
volshow and plot_isosurface differ by a transpose
Just a small note. It seems like consistency would be desirable. Perhaps there's some convention or reason for the difference that I'm not aware of.
The only difference between the following two plots is that in the second, f
is transposed in ipv.volshow
.
Without transpose
import numpy as np
import ipyvolume as ipv
t = np.linspace(0, 1, 21)
x, y, z = np.meshgrid(t,t,t)
f = x**2 - y + np.sin(2*np.pi*z)
ipv.figure()
ipv.volshow(f)
ipv.plot_isosurface(f, color='gray')
ipv.show()
With Transpose
import numpy as np
import ipyvolume as ipv
t = np.linspace(0, 1, 21)
x, y, z = np.meshgrid(t,t,t)
f = x**2 - y + np.sin(2*np.pi*z)
ipv.figure()
ipv.volshow(f.T)
ipv.plot_isosurface(f, color='gray')
ipv.show()
Clearly, the transpose is necessary for agreement between the two. Should one function or the other be modified so that they agree automatically?
Hi Olivier,
Good question, the rationale behind volshow is explained here: https://github.com/maartenbreddels/ipyvolume/issues/79#issuecomment-339735390 Basically, it is consistent with matplotlib's imshow. However, now with isosurface.. i'm not sure it still makes sense. I need to think about it.
cheers,
Maarten
Just dropping a note that I've experienced the same confusion when overlaying an isosurface on a volshow.
This confused me as well, I expected the different volume plots to behave the same. In any case, it would be helpful if the documentation stated the axis order.