Python ProgrammingPython Programming

How enable and check interactive mode in Matplotlib?

Check whether interactive mode is ON (True) or OFF (False):

import matplotlib as mpl
import matplotlib.pyplot as plt

# Set the interactive mode to ON
plt.ion()

# Check the current status of interactive mode
print(mpl.is_interactive())