I'm trying to plot a spherical harmonic coloured by phase.
e.g.
psi[l_, m_] := SphericalHarmonicY[l, m, θ, ϕ]
sphWithPhase[f_] :=
SphericalPlot3D[Abs[f]^2, {θ, 0, Pi}, {ϕ, 0, 2 Pi},
ColorFunction ->
Function[{x, y, z, θ, ϕ, r}, Evaluate[Hue[Arg[f]]]],
PlotRange -> All, ColorFunctionScaling -> False]
sphWithPhase[psi[1, -1]]
But it doesn't work. TracePrint shows that Function[] is renaming its arguments so that then the theta and phi don't match up to the plotted variables.
Whereas e.g.
SphericalPlot3D[Abs[psi[1, 1]]^2, {θ, 0, Pi}, {ϕ, 0, 2 Pi},
ColorFunction ->
Function[{x, y, z, θ, ϕ, r},
Evaluate[Hue[Arg[psi[1, 1]]]]]]
does work.
Can anyone help explain this to me, I find the help pages confusing?
Thanks.
ColorFunctionScaling -> False
and useColorFunction -> Function[{x, y, z, \[Theta]1, \[Phi]1, r}, Hue[Arg[f /. {\[Theta] -> \[Theta]1, \[Phi] -> \[Phi]1}]]]
? $\endgroup$ColorFunction -> (Hue[Arg[f /. {\[Theta] -> #4, \[Phi] -> #5}]] &)
? $\endgroup$ColorFunction -> (Function[{x, y, z, θ, ϕ, r}, #] & @ Hue[Arg[f]])
$\endgroup$