2

I have the following simple example

from numpy import pi, sin, cos, mgrid

dphi, dtheta = pi/250.0, pi/250.0
[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7
x = r*sin(phi)*cos(theta)
y = r*cos(phi)
z = r*sin(phi)*sin(theta)

# View it.
from mayavi import mlab
a= mlab.mesh(x, y, z)
mlab.savefig(filename='test.eps')
mlab.show()

Everything works fine apart from the saving part: the file test.eps is created but it seems to be either empty or corrupted (note that if I just save as .png it is fine).

I saw that this seems to be a recurrent problem with Mayavi but I am not able to figure out how to fix it, any idea? Or is it just an issue with my installation?

(I am using the latest version of Mayavi downloaded from github)

Mauro
  • 21
  • 1
  • Possible duplicate of [mayavi mlab.savefig() gives an empty image](https://stackoverflow.com/questions/16543634/mayavi-mlab-savefig-gives-an-empty-image) – Lokesh A. R. Mar 23 '18 at 11:19
  • I am aware of that discussion and so I am saving before showing, but it still does not work – Mauro Mar 23 '18 at 11:54

0 Answers0