code: def _plot_ica_overlay_raw(
      *, raw, raw_cln, picks, start, stop, title, show
  ):
      """Plot evoked after and before ICA cleaning.
  
      Parameters
      ----------
      raw : Raw
          Raw data before exclusion of ICs.
      raw_cln : Raw
          Data after exclusion of ICs.
      picks : array of shape (n_channels_selected,)
          Array of selected channel indices.
      start : int
          Start time to plot in samples.
      stop : int
          Stop time to plot in samples.
      title : str
          Title of the figure(s).
      show : bool
          Show figure if True.
  
      Returns
      -------
      fig : instance of Figure
      """
      import matplotlib.pyplot as plt
  
      ch_types = raw.get_channel_types(picks=picks, unique=True)
      for ch_type in ch_types:
          if ch_type in ("mag", "grad"):
              fig, ax = plt.subplots(
                  3, 1, sharex=True, layout="constrained"
              )
          elif ch_type == "eeg" and not _has_eeg_average_ref_proj(
              raw.info, check_active=True
          ):
              fig, ax = plt.subplots(
                  3, 1, sharex=True, layout="constrained"
              )
          else:
              fig, ax = plt.subplots(
                  2, 1, sharex=True, layout="constrained"
              )
          fig.suptitle(title)
  
          # select sensors and retrieve data array
          picks_by_type = _picks_to_idx(raw.info, ch_type, exclude=())
          picks_ = np.intersect1d(picks, picks_by_type)
          data, times = raw[picks_, start:stop]
          data_cln, _ = raw_cln[picks_, start:stop]
  
          # plot all sensors of the same type together
          ax[0].plot(times, data.T, color="r")
          ax[0].plot(times, data_cln.T, color="k")
          _ch_type = DEFAULTS["titles"].get(ch_type, ch_type)
          ax[0].set(
              xlabel="Time (s)",
              xlim=times[[0, -1]],
              title=f"Raw {_ch_type} data",
          )
  
          # second plot for M/EEG using GFP or RMS
          if ch_type == "eeg":  # Global Field Power
              ax[1].plot(times, np.std(data, axis=0), color="r")
              ax[1].plot(times, np.std(data_cln, axis=0), color="k")
              ax[1].set(
                  xlabel="Time (s)",
                  xlim=times[[0, -1]],
                  title=f"{_ch_type} Global Field Power",
              )
          elif ch_type in ("mag", "grad"):  # RMS
              ax[1].plot(
                  times, np.sqrt((data**2).mean(axis=0)), color="r"
              )
              ax[1].plot(
                  times,
                  np.sqrt((data_cln**2).mean(axis=0)),
                  color="k",
              )
              ax[1].set(
                  xlabel="Time (s)",
                  xlim=times[[0, -1]],
                  title=f"{_ch_type} RMS",
              )
  
          # last plot with the average across all channels of the same type
          if ch_type != "eeg" or not _has_eeg_average_ref_proj(
              raw.info, check_active=True
          ):
              ax[-1].plot(times, data.mean(axis=0), color="r")
              ax[-1].plot(times, data_cln.mean(axis=0), color="k")
              ax[-1].set(
                  xlabel="Time (s)",
                  xlim=times[[0, -1]],
                  title=f"Average across {_ch_type} channels",
              )
      plt_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 11 for calling a global function with example usage: _plot_ica_overlay_raw() and returns: fig