I am using mayavi with Python. Suppose that I have dataset of a 3D surface mesh: the positions of vertices X, Y, Z, and the triangles T (dimensions: E * 3) which consists of node numbers. The mesh has N vertices and E triangles. I can plot the mesh like below

The commands are like
from mayavi import mlab as ML
ML.triangular_mesh(X, Y, Z, T, scalars=Z, opacity=0.9)
### ... other commands
ML.show()
You can see from both the command and the above plot that the colormap is based on the z values of vertices. This is a result of scalars=Z.
Now, I do not want to make a colormap based on vertices. Suppose that I have a array that stores E*1 values. Each value corresponds to one kind of attribute of each triangle. I want to generate the colormap based on the 1D array related to triangles' attribute. How can I achieve that?
I do know matlab can do that by using patch function. Details are in here. But I prefer using mayavi.
Well, I found a method to set face color (each triangle is a face). The result is below
The script is like:
Details are presented in here