incorrect obj file with savefig
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 316
- Avg merge
- 7h 44m
- Merged PRs (30d)
- 5
Description
After writing a mesh to .obj format the color is discarded. An example script is included below.
The generated .obj file starts with
```
# wavefront obj file written by the visualization toolkit
mtllib /home/eendebakpt/tmp/dummy3.mtl
v 0.880769 0 0.2
v 0.880769 0 0.2
```
but this should be
```
# wavefront obj file written by the visualization toolkit
mtllib /home/eendebakpt/tmp/dummy3.mtl
usemtl mtl1
v 0.880769 0 0.2
v 0.880769 0 0.2
```
An example script to generate the .obj:
``` python
from mayavi import mlab
import numpy as np
from scipy.special import sph_harm
# Create a sphere
r = 0.2
pi = np.pi
cos = np.cos
sin = np.sin
phi, theta = np.mgrid[0:pi:17j, 0:2 * pi:17j]
x = r * sin(phi) * cos(theta)
y = r * sin(phi) * sin(theta)
z = r * cos(phi)
x += np.random.rand()
mlab.figure(1, bgcolor=(1, 1, 1), fgcolor=(0, 0, 0), size=(400, 300))
mlab.clf()
# Represent spherical harmonics on the surface of the sphere
n=1; m=1
s = sph_harm(m, n, theta, phi).real
mm=mlab.mesh(x, y, z, color=(1.,1.,0.) , colormap='jet')
mlab.view(90, 70, 6.2, (-1.3, -2.9, 0.25))
mlab.savefig('/home/eendebakpt/tmp/dummy3.obj')
mlab.show()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.