Re: VectorColorFunction

*To*: mathgroup at smc.vnet.net*Subject*: [mg124479] Re: VectorColorFunction*From*: Dan <dflatin at rcn.com>*Date*: Sat, 21 Jan 2012 05:14:53 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <jfb3dr$hu0$1@smc.vnet.net>

On Jan 20, 2:00 am, Peter Rodenbach <peter.rodenb... at googlemail.com> wrote: > Hi experts, > > I want to plot via ListVectorPlot a Field of Vectors. I obtained the > vectors from a physics experiment. The Norm of all vectors is very > similar, and what is important is its direction! > > Therefore, what I want to do now is: give each vector a color with a > different direction a different color, e.g., up to 0.5degree red, 0.5 > to 1 degree yellow, etc. > > The Problem: The norm of each vector is used as argument for the > function that determines the color, according to the help > > "With the setting VectorColorFunction->func, the arguments supplied to > func are as follows" ,...., x,y,Subscript[v, x],Subscript[v, > y],Norm[{Subscript[v, x],Subscript[v, y]}]" > > Does anyone have an idea for a workaround? > > Thanks > > Peter Another solution, using VectorColorFunction: directionHue={x,y,vx,vy,n}\[Function]Hue[Rescale[ArcTan[vx,vy],{-\[Pi], \[Pi]}]]; data=Table[{Sin[x],Cos[y]},{x,-2,2,0.1},{y,-2,2,0.1}]; ListVectorPlot[data, VectorColorFunction->directionHue, VectorColorFunctionScaling->False ] -- Dan