I've been using Mayavi to make some very nice vector plots lately. Using Numpy, I read in data from file (which is organized in columns as 'x y z Vx Vy Vz') and then plot the results using Mayavi:
#Import libraries
from mayavi import mlab
import numpy as np
#Read in data
data = np.loadtxt('filename', float)
x = data[:,0]
y = data[:,1]
z = data[:,2]
Vx = data[:,3]
Vy = data[:,4]
Vz = data[:,5]
#Plot
mlab.quiver3d(x, y, z, Vx, Vy, Vz, mode='arrow', colormap = 'jet')
mlab.show()
This worked fine until I needed to plot normalized vectors. Namely, the magnitude of all the vectors is 1. The quiver3d function gives a vector its color based on its magnitude, so right now every vector is one color. However, the information I need to convey is based on orientation of the vectors.
I'd love if someone could help me figure out how to color vectors in Mayavi using the vector's direction and NOT its magnitude.