def switch_backend(newbackend):
close('<STR_LIT:all>')<EOL>global new_figure_manager, draw_if_interactive, show<EOL>matplotlib.use(newbackend, warn=False)<EOL>reload(matplotlib.backends)<EOL>from matplotlib.backends import pylab_setup<EOL>new_figure_manager, draw_if_interactive, show = pylab_setup()<EOL>
Switch the default backend to newbackend.  This feature is
**experimental**, and is only expected to work switching to an
image backend.  Eg, if you have a bunch of PostScript scripts that
you want to run from an interactive ipython session, you may want
to switch to the PS backend before running them to avoid having a
bunch of GUI windows popup.  If you try to interactively switch
from one GUI backend to another, you will explode.

Calling this command will close all open windows.