How to Solve NameError: name 'Polygon' is not defined -- matplotlib

Solution: Import the 'Polygon' module

To Solve the error, add the following line to the top of your code.

from matplotlib.patches import Polygon

 

For more information:
Python matplotlib Polygon