Clear["Global`*"]
SphericalHarmonicY[1, 0 , θ, Φ]
is real for real {θ, Φ}
FunctionDomain[
SphericalHarmonicY[1, 0, θ, Φ], {θ, Φ}]
(* True *)
The min and max values are
{min, max} = #[{Re@SphericalHarmonicY[1, 0, θ, Φ],
0 <= θ <= Pi,
0 <= Φ <= 2 Pi}, {θ, Φ}] & /@ {MinValue,
MaxValue}
(* {-(Sqrt[(3/π)]/2), Sqrt[3/π]/2} *)
For Red
for zero and Blue
at both of the extremes:
SphericalPlot3D[1, {θ, 0, π}, {Φ, 0, 2 π},
ColorFunction -> Function[{x, y, z, θ, Φ, r},
Blend[{Blue, Red, Blue},
Rescale[SphericalHarmonicY[1, 0, θ, Φ], {min, max}]]],
PlotPoints -> 100,
ColorFunctionScaling -> False,
Mesh -> False,
Boxed -> False,
Axes -> False]
For Blue
at negative extreme, Red
at zero, and Yellow
at positive extreme:
SphericalPlot3D[1, {θ, 0, π}, {Φ, 0, 2 π},
ColorFunction -> Function[{x, y, z, θ, Φ, r},
Blend[{Blue, Red, Yellow},
Rescale[SphericalHarmonicY[1, 0, θ, Φ], {min, max}]]],
PlotPoints -> 100,
ColorFunctionScaling -> False,
Mesh -> False,
Boxed -> False,
Axes -> False]
EDIT: For variable {l, m}
in SphericalHarmonicY[l, m, θ, Φ]
Manipulate[
Module[{min, max},
m = Min[m, l];
{min, max} =
N[#[{Re@SphericalHarmonicY[l, m, θ, Φ],
0 <= θ <= Pi, 0 <= Φ <= 2 Pi}, {θ, Φ},
WorkingPrecision -> 15] & /@
{NMinValue, NMaxValue}];
Column[{
StringForm["min = ``, max = ``",
Round[min, 0.01], Round[max, 0.01]],
SphericalPlot3D[
1, {θ, 0, π}, {Φ, 0, 2 π},
ColorFunction -> Function[{x, y, z, θ, Φ, r},
Blend[{Blue, Red, Blue},
Rescale[
Re@SphericalHarmonicY[l, m, θ, Φ], {min,
max}]]],
PlotPoints -> 100,
ColorFunctionScaling -> False,
Mesh -> {{0.}},
MeshFunctions -> {Function[{x, y, z, θ, Φ,
r},
Re@SphericalHarmonicY[l, m, θ, Φ]]},
MeshStyle -> {Black, Thick},
Boxed -> False,
Axes -> False,
ImageSize -> Medium]}]],
{{l, 1}, Range[5], ControlType -> SetterBar},
{{m, 0}, Range[0, l], ControlType -> SetterBar}]
Blend
$\endgroup$Blend
? $\endgroup$SphericalPlot3D[1, {\[Theta], 0, \[Pi]}, {\[CapitalPhi], 0, 2 \[Pi]}, ColorFunction -> Function[{x, y, z, \[Theta], \[CapitalPhi], r}, Blend[{Red, Blue}, Re@SphericalHarmonicY[1, 0, \[Theta], \[CapitalPhi]]]], PlotPoints -> 100, ColorFunctionScaling -> False, Mesh -> False, Boxed -> False, Axes -> False]
$\endgroup$