l = 1;
g = 9.8;
ContourPlot[(1./2.)*l^2*w^2 + g*l*(1.-Cos[theta]),
{theta,-4Pi,4Pi},{w,-15,15},
PlotLegends->Automatic,
FrameLabel -> {"theta (rad)","omega (rad/s)"}]