plot 2d polar matlab
my mistake, some pages are ok, but the matlab files are dead links.
let me make it up with this matlab code that should be very close to what you want (it actually defines then plots spherical harmonics)
L=2;M=1;
theta=pi*linspace(0,1,30);
phi=2*pi*linspace(0,1,60);
r=legendre(L,cos(theta),'sch');
dd=r(M+1,
;dd=abs(dd' * cos(M*phi));
X=dd.*(sin(theta)'*cos(phi));
Y=dd.*(sin(theta)'*sin(phi));
Z=dd.*(cos(theta)'*ones(size(phi)));
figure(1);clf;mesh(X,Y,Z),
shading flat;
axis on;axis square;axis([-1 1 -1 1 -1 1]);
colormap gray;
caxis([0 10]);