def activate_matplotlib(backend):
 import matplotlib
 matplotlib.interactive(True)
 matplotlib.rcParams['backend'] = backend
 import matplotlib.pyplot
 matplotlib.pyplot.switch_backend(backend)
 import matplotlib.pyplot as plt
 plt.show._needmain = False
 plt.draw_if_interactive = flag_calls(plt.draw_if_interactive)

def activate_matplotlib ( backend ) : import matplotlib matplotlib . interactive ( True ) matplotlib . rcParams [ 'backend' ] = backend import matplotlib . pyplot matplotlib . pyplot . switch_backend ( backend ) import matplotlib . pyplot as plt plt . show . _needmain = False plt . draw_if_interactive = flag_calls ( plt . draw_if_interactive )
activate the given backend and set interactive to true .