Search code examples
pythonmatplotlibsuptitle

NameError in Python - suptitle not defined


fig = suptitle('image #{}'.format(num), fontsize=20)
NameError: name 'suptitle' is not defined

I already installed numpy, scipy and matplotlib and imported pylab but for some reason Python isn't recognizing the suptitle function.


Solution

  • I think you need:

    import matplotlib.pyplot as plt
    
    plt.suptitle('image #{}'.format(num), fontsize = 20)