enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

How to make the arrow color change with their directions? #1220

Closed shz224 closed 1 year ago

shz224 commented 1 year ago

Thanks for the wonderful package. I'm using quiver3d to plot a vector field with (x, y, z, u, v, w). I wonder how to make the arrow color change with their directions instead of length.

srk commented 1 year ago

Perhaps precompute a list of scalars, one for each vector, where the scalar is the dot product of the (normalized) vectors and some reference vector, e.g. (0, 0, 1). That will get you a number in the range (-1,1). Use these numbers as a lookup table into a scale of colors .

shz224 commented 1 year ago

OK, thanks.

prabhuramachandran commented 1 year ago

I assume this is solved so am closing.