code: def plot_ica_overlay(
      ica,
      inst,
      exclude=None,
      picks=None,
      start=None,
      stop=None,
      title=None,
      show=True,
      n_pca_components=None,
      *,
      on_baseline="warn",
      verbose=None,
  ):
      """Overlay of raw and cleaned signals given the unmixing matrix.
  
      This method helps visualizing signal quality and artifact rejection.
  
      Parameters
      ----------
      ica : instance of mne.preprocessing.ICA
          The ICA object.
      inst : instance of Raw or Evoked
          The signal to plot. If `~mne.io.Raw`, the raw data per channel type is displayed
          before and after cleaning. A second panel with the RMS for MEG sensors and the
          :term:`GFP` for EEG sensors is displayed. If `~mne.Evoked`, butterfly traces for
          signals before and after cleaning will be superimposed.
      exclude : array-like of int | None (default)
          The components marked for exclusion. If ``None`` (default), the components
          listed in ``ICA.exclude`` will be used.
      %(picks_base)s all channels that were included during fitting.
      start, stop : float | None
         The first and last time point (in seconds) of the data to plot. If
         ``inst`` is a `~mne.io.Raw` object, ``start=None`` and ``stop=None``
         will be translated into ``start=0.`` and ``stop=3.``, respectively. For
         `~mne.Evoked`, ``None`` refers to the beginning and end of the evoked
         signal.
      %(title_none)s
      %(show)s
      %(n_pca_components_apply)s
  
          .. versionadded:: 0.22
      %(on_baseline_ica)s
      %(verbose)s
  
      Returns
      -------
      fig : instance of Figure
          The figure.
      """
      # avoid circular imports
      from ..evoked import Evoked
      from ..io import BaseRaw
      from ..preprocessing.ica import _check_start_stop
  
      if ica.current_fit == "unfitted":
          raise RuntimeError("You need to fit the ICA first")
  
      _validate_type(inst, (BaseRaw, Evoked), "inst", "Raw or Evoked")
      if title is None:
          title = "Signals before (red) and after (black) cleaning"
      picks = ica.ch_names if picks is None else picks
      picks = _picks_to_idx(inst.info, picks, exclude=())
      if exclude is None:
          exclude = ica.exclude
      if not isinstance(exclude, (np.ndarray, list)):
          raise TypeError(
              "exclude must be of type list. Got %s" % type(exclude)
          )
      if isinstance(inst, BaseRaw):
          start = 0.0 if start is None else start
          stop = 3.0 if stop is None else stop
          start, stop = _check_start_stop(inst, start, stop)
          raw_cln = ica.apply(
              inst.copy(),
              exclude=exclude,
              start=start,
              stop=stop,
              n_pca_components=n_pca_components,
          )
          fig = _plot_ica_overlay_raw(
              raw=inst,
              raw_cln=raw_cln,
              picks=picks,
              start=start,
              stop=stop,
              title=title,
              show=show,
          )
      else:
          assert isinstance(inst, Evoked)
          inst = inst.copy().crop(start, stop)
          if picks is not None:
              with inst.info._unlock():
                  inst.info["comps"] = []  # can be safely disabled
              inst.pick([inst.ch_names[p] for p in picks])
          evoked_cln = ica.apply(
              inst.copy(),
              exclude=exclude,
              n_pca_components=n_pca_components,
              on_baseline=on_baseline,
          )
          fig = _plot_ica_overlay_evoked(
              evoked=inst, evoked_cln=evoked_cln, title=title, show=show
          )
  
      return fig
  
imports: import warnings
  from functools import partial
  import numpy
  from scipy.stats import gaussian_kde
  from .._fiff.meas_info import create_info
  from .._fiff.pick import _picks_to_idx, pick_types
  from .._fiff.proj import _has_eeg_average_ref_proj
  from ..defaults import DEFAULTS, _handle_default
  from ..utils import _reject_data_segments, _validate_type, fill_doc, verbose
  from .epochs import plot_epochs_image
  from .evoked import _butterfly_on_button_press, _butterfly_onpick
  from .topomap import _plot_ica_topomap
  from .utils import _compute_scalings, _convert_psds, _get_cmap, _get_plot_ch_type, _handle_precompute, _make_event_color_dict, plt_show
label_desc: Use image node_id 10 for calling a global function with example usage: plot_ica_overlay(ica, inst, exclude, picks, start, stop, title, show, n_pca_components) and returns: fig