Updated examples to use pyplot for plotting instead of pylab

Some examples not updated because scripts throw error (probably not
because of the change)
Fixed pep8 violations. Some 'line too long' errors still remain.
Fixed some PEP8 violations even present in master branch, in examples/

This fixes some of the violations that were not caused by the change to pyplot
from pylab.
Merge pull request #3151 from rajatkhanduja/fixing_examples

Updated examples to use pyplot for plotting instead of pylab