code: def activate_matplotlib(backend):
      """Activate the given backend and set interactive to True."""
  
      import matplotlib
  
      matplotlib.interactive(True)
  
      # Matplotlib had a bug where even switch_backend could not force
      # the rcParam to update. This needs to be set *before* the module
      # magic of switch_backend().
      matplotlib.rcParams["backend"] = backend
  
      import matplotlib.pyplot
  
      matplotlib.pyplot.switch_backend(backend)
  
      # This must be imported last in the matplotlib series, after
      # backend/interactivity choices have been made
      import matplotlib.pyplot as plt
  
      plt.show._needmain = False
      # We need to detect at runtime whether show() is called by the user.
      # For this, we wrap it into a decorator which adds a 'called' flag.
      plt.draw_if_interactive = flag_calls(plt.draw_if_interactive)
  
file_path: catboost/contrib/python/ipython/py2/IPython/core/pylabtools.py
imports: from __future__ import print_function
  from io import BytesIO
  from IPython.core.display import _pngxy
  from IPython.utils.decorators import flag_calls
  from IPython.utils import py3compat
label_desc: Use image node_id 9 for calling a global function with example usage: activate_matplotlib(backend) without return types