How to Solve NameError: name 'pyplot' is not defined -- matplotlib
Solution: Import the 'pyplot' module
To Solve the error, add the following line to the top of your code.
from matplotlib import pyplot
For more information:
Python matplotlib pyplot