and <code>phi</code> is the counterclockwise angle off the x axis in the xy plane (longitude). Both angles are in radians. <code>theta</code> and <code>phi</code> can be scalars or alternatively arrays of the same size.
</p>

<p>
If <code>'r'</code>, real-valued spherical harmonics are evaluated. These are linear combinations of the complex-valued spherical harmonics. Their signs are defined such that they give nonnegative values near <code>theta=0</code> and <code>phi=0</code> for all <code>L</code> and <c