Mayavi2 eps output

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Mayavi2 eps output

Balmer, Matthew
Hi,

I have the following code:

def test_points3d():
#*******x  y  z  # of captures
    A = np.array([
    [ 0, 0, 0, 1.3],
    [ 1, 0, 0, 0.6],
    [ 2, 0, 0, 0.7],
    [ 3, 0, 1, 1.6],
    [ 4, 3, 1, 0.5],
    [ 0, 1, 0, 3.5],
    [ 0, 2, 0, 2.5],
    [ 0, 3, 0, 1.3],      
    [ 0, 4, 0, 1.2],
    [ 5, 5, 1, 2.5],
    [ 5, 5, 2, 3]
    ])

    x = A[:,0]
    y = A[:,1]
    z = A[:,2]
    s = A[:,3]

    return points3d(x, y, z, s, colormap="jet", scale_mode="none", scale_factor=1, mode="cube")

# View it.
from mayavi import mlab
mlab.figure(1, bgcolor=(1, 1, 1))
mlab.clf()

s = test_points3d()

#graph = mlab.pipeline.volume(mlab.pipeline.gaussian_splatter(s))

mlab.show()

Which is a simplified version of a graphing script I am trying to output an eps from.

Going through the above code, I can output a .eps or ps file through the GUI interface or using mlab.savfig('test.eps') from the python command terminal.  If I uncomment the gaussian splatter code then I get a blank output in the .eps file.

Having played around with this, a legend or added axes get added to the EPS file but not the volume that has been run through the gaussian splatter.  The PNG output option works fine regardless of the gaussian splatter.

This is driving me mad as I can't see a way to get my graph into a suitable format to put onto a conference poster.

I'm using Mayavi 4.3.0, vtk version 5.8.0 and Ubuntu.  (have same problem on 4.0.0 of mayavi2)

Any pointers how to get this working or what logs will help someone else debug this?

Cheers.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Mayavi2 eps output

Roan LaPlante
I have reproduced this bug, and I don't know how to fix it but I may know how to hack it.  Try this:

fig=mlab.figure(bgcolor=whatever)
fig.scene.magnification=n #i suggest n>=5
fig.scene.save_ps('/path/to/filename.eps')

The quality on this image is terrible (or at least it was on my test images), so I suggest increasing the magnification to provide a high resolution image that can be scaled down.

R


On Mon, May 13, 2013 at 10:44 AM, Balmer, Matthew <[hidden email]> wrote:
Hi,

I have the following code:

def test_points3d():
#*******x  y  z  # of captures
    A = np.array([
    [ 0, 0, 0, 1.3],
    [ 1, 0, 0, 0.6],
    [ 2, 0, 0, 0.7],
    [ 3, 0, 1, 1.6],
    [ 4, 3, 1, 0.5],
    [ 0, 1, 0, 3.5],
    [ 0, 2, 0, 2.5],
    [ 0, 3, 0, 1.3],
    [ 0, 4, 0, 1.2],
    [ 5, 5, 1, 2.5],
    [ 5, 5, 2, 3]
    ])

    x = A[:,0]
    y = A[:,1]
    z = A[:,2]
    s = A[:,3]

    return points3d(x, y, z, s, colormap="jet", scale_mode="none", scale_factor=1, mode="cube")

# View it.
from mayavi import mlab
mlab.figure(1, bgcolor=(1, 1, 1))
mlab.clf()

s = test_points3d()

#graph = mlab.pipeline.volume(mlab.pipeline.gaussian_splatter(s))

mlab.show()

Which is a simplified version of a graphing script I am trying to output an eps from.

Going through the above code, I can output a .eps or ps file through the GUI interface or using mlab.savfig('test.eps') from the python command terminal.  If I uncomment the gaussian splatter code then I get a blank output in the .eps file.

Having played around with this, a legend or added axes get added to the EPS file but not the volume that has been run through the gaussian splatter.  The PNG output option works fine regardless of the gaussian splatter.

This is driving me mad as I can't see a way to get my graph into a suitable format to put onto a conference poster.

I'm using Mayavi 4.3.0, vtk version 5.8.0 and Ubuntu.  (have same problem on 4.0.0 of mayavi2)

Any pointers how to get this working or what logs will help someone else debug this?

Cheers.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.




--
Roan LaPlante
Athinoula A. Martinos Center for Biomedical Imaging


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Mayavi2 eps output

Gael Varoquaux
I wouldn't relie on EPS output. It works only for very simple situation.
Do a jpg and use a jpg to EPS converter.

G
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev