from sympy import *
from spb import *
import param
n, m = symbols("n, m")
phi, theta = symbols("phi, theta", real=True)
r = re(Ynm(n, m, theta, phi).expand(func=True).rewrite(sin).expand())
graphics(
    surface_spherical(abs(r), (theta, 0, pi), (phi, 0, 2*pi),
        label="real",
        params = {
            n: param.Integer(2, label="n"),
            m: param.Integer(0, label="m"),
        },
        use_cm=True, color_func=r, force_real_eval=True),
    backend=PB, imodule="panel")