enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.3k stars 284 forks source link

mlab.imshow positions the image incorrectly #451

Open alexbjorling opened 7 years ago

alexbjorling commented 7 years ago

With mayavi 4.5.0, setting the extent of an image while calling imshow does not cause an exception like it did before (see issue #37 ). But still, specifying the extent keyword does not have the expected effect. In the following example, the image is incorrectly placed in the xy-plane, instead of the xz-plane as specified. The scaling is also wrong.

import numpy as np
from mayavi import mlab

image = np.random.random((100,100))

im = mlab.imshow(image,
                 extent = [0, 50, 0, 0, 0, 50],
                 interpolate=False, opacity=.3)
mlab.axes(im)

On the other hand, specifying the extent within the xy-plane works as expected.

im = mlab.imshow(image,
                 extent = [0, 50, 0, 50, 0, 0],
                 interpolate=False, opacity=.3)

The image positioning above could be accomplished with something like what follows, but that's very involved and requires too much maths for easy application. Also, it has to be done afterwards as imshow lacks these kwargs.

im.actor.orientation = [90, 0, 0]
im.actor.position = [25, 0, 25]
im.actor.scale = [.5, .5, .5]
alexbjorling commented 7 years ago

@prabhuramachandran @dmsurti

pordyna commented 1 year ago

Today I run into the exact same issue.