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

Solution: Import the 'figure' module

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

from matplotlib.pyplot import figure

 

For more information:
Python matplotlib figure