Re: Colorfunction based upon flux direction
- To: mathgroup at smc.vnet.net
- Subject: [mg87184] Re: Colorfunction based upon flux direction
- From: dh <dh at metrohm.ch>
- Date: Thu, 3 Apr 2008 05:16:56 -0500 (EST)
- References: <fsd6ps$9hd$1@smc.vnet.net>
Hi Patrick, I answered this question 5 days ago, but it never made it to the group. Here it is the answer again: in ListVectorFieldPlot3D the color function gets the magnitude of the vector as argument. Therefore, there is no direction info available. You must use a trick to do this, e.g. you could use a counter to access the original vectors: n=5; d=Table[r=rad{Sin[p1]Sin[p2],Sin[p1]Cos[p2],Cos[p1]};{r,r},{rad,0.01,1,1/n},{p1,0,Pi,Pi/n},{p2,0,2 Pi,Pi/n}]; d=Flatten[d,2]; count=0; ListVectorFieldPlot3D[d,ColorFunction->Function[{x},Hue[r= d[[++count,2]];0.5+0.5 r.{1,0,0}/Sqrt[ r.r]]]] hope this helps, Daniel ptk4m at virginia.edu wrote: > Hello, > > I'm quite new at using Mathematica and I am attempting to assign > colors to vector field data (3d magnetic flux) using the > ListVectorFieldPlot3D function. I would like to assign colors to the > vectors based upon the direction in which they point. Hue gives me a > color based upon vector magnitude - is there a simple way to color > vectors based upon direction? > > Thank you very much for your help. > > Patrick Keith-Hynes > University of Virginia Physics > >