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
  
      # Due to circular imports, pyplot may be only partially initialised
      # when this function runs.
      # So avoid needing matplotlib attribute-lookup to access pyplot.
      from matplotlib import pyplot as plt
  
      plt.switch_backend(backend)
  
      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/py3/IPython/core/pylabtools.py
imports: from io import BytesIO
  from binascii import b2a_base64
  from functools import partial
  import warnings
  from IPython.core.display import _pngxy
  from IPython.utils.decorators import flag_calls
label_desc: Use image node_id 9 for calling a global function with example usage: activate_matplotlib(backend) without return types