ipyvolume icon indicating copy to clipboard operation
ipyvolume copied to clipboard

volshow and plot_isosurface differ by a transpose

Open OliverEvans96 opened this issue 6 years ago • 3 comments

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()

without_transpose

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()

with_transpose


Clearly, the transpose is necessary for agreement between the two. Should one function or the other be modified so that they agree automatically?

OliverEvans96 avatar Mar 14 '18 15:03 OliverEvans96

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

maartenbreddels avatar Mar 16 '18 13:03 maartenbreddels

Just dropping a note that I've experienced the same confusion when overlaying an isosurface on a volshow.

OrganicIrradiation avatar Sep 04 '19 17:09 OrganicIrradiation

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.

fjansson avatar Jul 01 '20 13:07 fjansson