Re: Coloring a Sphere
- To: mathgroup at smc.vnet.net
- Subject: [mg9402] Re: [mg9378] Coloring a Sphere
- From: seanross at worldnet.att.net
- Date: Sun, 2 Nov 1997 01:02:30 -0500
- Sender: owner-wri-mathgroup at wolfram.com
David Farrelly wrote: > > I am trying to plot a function D[alpha,beta,gamma] where alpha,beta and > gamma are euler angles and thus define a point on the surface of a > sphere. What I would like to do is to plot the sphere and color it > according to the value of the function Abs[D]. I can't figure out from > the Mathematica manual how to do this. > > david Farrelly In 3D graphics, there is an option ColorFunction. If you think of the plot as z[x,y], then the color function takes as an argument z such that z ranges from 0 to 1, with zero being the lowest value in the plot and 1 being the highest, thus: Plot[x^2+y^2,{x,-2,2},{y,-2,2},ColorFunction->Hue] prints a parabola which is Red at the bottom Hue[0.] and goes through the rainbow ending up with Red at the top Hue[1.]. If you want different color maps, then use the Pure Function idea: Plot[x^2+y^2,{x,-2,2},{y,-2,2},ColorFunction->(Hue[Sqrt[#]+.2]&)] Don't forget the parenthesis around the Hue or you'll get an error message.