use %matplotlib

and add missing imports implied by %pylab