Color in Spherical3DPlot according to value

I want to colour a 3D plot according to it's value. I could only mange in one direction (say in 'z' direction) but I want to show them in all direction together. I have written the following code:

cf = ColorData["Rainbow"];
plot = SphericalPlot3D[
1/((Sin[\[Theta]]^4*
Cos[\[Phi]]^4*0.049896792) + (2*(Sin[\[Theta]]*
Cos[\[Phi]])^2*(Sin[\[Theta]]*
Sin[\[Phi]])^2*(-0.01555592)) + (2*(Sin[\[Theta]]*
Cos[\[Phi]])^2*(Cos[\[Theta]])^2*(-0.030833372)) + (Sin[\
\[Theta]]^4*
Sin[\[Phi]]^4*0.011343866) + (2*(Sin[\[Theta]]*
Sin[\[Phi]])^2*(Cos[\[Theta]])^2*(0.007005355)) + (Cos[\
\[Theta]]^4*0.025839216) + ((Sin[\[Theta]]*
Sin[\[Phi]])^2*(Cos[\[Theta]])^2*(0.01848854)) + ((Sin[\
\[Theta]]*
Cos[\[Phi]])^2*(Cos[\[Theta]])^2*(0.020627753)) + ((Sin[\
\[Theta]]*Cos[\[Phi]])^2*(Sin[\[Theta]]*
Sin[\[Phi]])^2*(0.031580823))), {\[Theta],
0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
ColorFunction -> (cf@Rescale[#3, {0, 100}] &), Axes -> True,
ColorFunctionScaling -> False]


And here is the output I got:

I am using Mathematica 8 version and my desire output would be something like (forget about the shape, picture is just for understanding. I want the color description) shown below:

• Try ColorFunction -> (ColorData["Rainbow", #6] &) (without the ColorFunctionScaling setting). This is in the docs... – J. M.'s torpor May 23 '16 at 15:57
• @J.M.: Nice!! I couldn't think about this smart way. Thank you! – baban May 23 '16 at 16:04

The ColorFunction for SphericalPlot3D takes 6 arguments, referring to the Cartesian and spherical coordinates.

cf = ColorData["Rainbow"];
plot = SphericalPlot3D[
1/((Sin[θ]^4*
Cos[ϕ]^4*0.049896792) + (2*(Sin[θ]*
Cos[ϕ])^2*(Sin[θ]*
Sin[ϕ])^2*(-0.01555592)) + (2*(Sin[θ]*
Cos[ϕ])^2*(Cos[θ])^2*(-0.030833372)) + (Sin[θ]^4*
Sin[ϕ]^4*0.011343866) + (2*(Sin[θ]*
Sin[ϕ])^2*(Cos[θ])^2*(0.007005355)) + (Cos[θ]^4*0.025839216) + ((Sin[θ]*
Sin[ϕ])^2*(Cos[θ])^2*(0.01848854)) + ((Sin[θ]*
Cos[ϕ])^2*(Cos[θ])^2*(0.020627753)) + ((Sin[θ]*Cos[ϕ])^2*(Sin[θ]*
Sin[ϕ])^2*(0.031580823))),
{θ, 0, π}, {ϕ, 0, 2 π},
ColorFunction -> Function[{x, y, z, θ, ϕ, r}, cf@#],
Axes -> True] & /@ {x, y, z, θ, ϕ, r}


I think you want the last one, scaling by r.

• Jason, I edited your text as it implied that ColorFunction only took one argument. – rcollyer May 23 '16 at 15:58
• @JasonB: Thank you so much for your quick reply. Yes, you got the right one. – baban May 23 '16 at 16:02
• @rcollyer Thanks for clarifying the post, I do get a bit sloppy at the end of the workday – Jason B. May 23 '16 at 17:18