code: def plot_evoked_white(
      evoked,
      noise_cov,
      show=True,
      rank=None,
      time_unit="s",
      sphere=None,
      axes=None,
      verbose=None,
  ):
      """Plot whitened evoked response.
  
      Plots the whitened evoked response and the whitened GFP as described in
      :footcite:`EngemannGramfort2015`. This function is especially useful for
      investigating noise covariance properties to determine if data are
      properly whitened (e.g., achieving expected values in line with model
      assumptions, see Notes below).
  
      Parameters
      ----------
      evoked : instance of mne.Evoked
          The evoked response.
      noise_cov : list | instance of Covariance | path-like
          The noise covariance. Can be a string to load a covariance from disk.
      show : bool
          Show figure if True.
      %(rank_none)s
      time_unit : str
          The units for the time axis, can be "ms" or "s" (default).
  
          .. versionadded:: 0.16
      %(sphere_topomap_auto)s
      axes : list | None
          List of axes to plot into.
  
          .. versionadded:: 0.21.0
      %(verbose)s
  
      Returns
      -------
      fig : instance of matplotlib.figure.Figure
          The figure object containing the plot.
  
      See Also
      --------
      mne.Evoked.plot
  
      Notes
      -----
      If baseline signals match the assumption of Gaussian white noise,
      values should be centered at 0, and be within 2 standard deviations
      (±1.96) for 95%% of the time points. For the global field power (GFP),
      we expect it to fluctuate around a value of 1.
  
      If one single covariance object is passed, the GFP panel (bottom)
      will depict different sensor types. If multiple covariance objects are
      passed as a list, the left column will display the whitened evoked
      responses for each channel based on the whitener from the noise covariance
      that has the highest log-likelihood. The left column will depict the
      whitened GFPs based on each estimator separately for each sensor type.
      Instead of numbers of channels the GFP display shows the estimated rank.
      Note. The rank estimation will be printed by the logger
      (if ``verbose=True``) for each noise covariance estimator that is passed.
  
      References
      ----------
      .. [1] Engemann D. and Gramfort A. (2015) Automated model selection in
             covariance estimation and spatial whitening of MEG and EEG
             signals, vol. 108, 328-342, NeuroImage.
      """
      import matplotlib.pyplot as plt
  
      from ..cov import Covariance, _ensure_cov, whiten_evoked
  
      time_unit, times = _check_time_unit(time_unit, evoked.times)
  
      _validate_type(noise_cov, (list, tuple, Covariance, "path-like"))
      if not isinstance(noise_cov, (list, tuple)):
          noise_cov = [noise_cov]
      for ci, c in enumerate(noise_cov):
          noise_cov[ci] = _ensure_cov(
              noise_cov[ci], f"noise_cov[{ci}]", verbose=False
          )
  
      evoked = evoked.copy()  # handle ref meg
      passive_idx = [
          idx
          for idx, proj in enumerate(evoked.info["projs"])
          if not proj["active"]
      ]
      # either applied already or not-- else issue
      for idx in passive_idx[
          ::-1
      ]:  # reverse order so idx does not change
          evoked.del_proj(idx)
  
      evoked.pick_types(
          ref_meg=False, exclude="bads", **_PICK_TYPES_DATA_DICT
      )
      n_ch_used, rank_list, picks_list, has_sss = _triage_rank_sss(
          evoked.info, noise_cov, rank, scalings=None
      )
      if has_sss:
          logger.info(
              "SSS has been applied to data. Showing mag and grad "
              "whitening jointly."
          )
  
      # get one whitened evoked per cov
      evokeds_white = [
          whiten_evoked(evoked, cov, picks=None, rank=r)
          for cov, r in zip(noise_cov, rank_list)
      ]
  
      def whitened_gfp(x, rank=None):
          """Whitened Global Field Power.
  
          The MNE inverse solver assumes zero mean whitened data as input.
          Therefore, a chi^2 statistic will be best to detect model violations.
          """
          return np.sum(x**2, axis=0) / (
              len(x) if rank is None else rank
          )
  
      # prepare plot
      if len(noise_cov) > 1:
          n_columns = 2
          n_extra_row = 0
      else:
          n_columns = 1
          n_extra_row = 1
  
      n_rows = n_ch_used + n_extra_row
      want_shape = (
          (n_rows, n_columns) if len(noise_cov) > 1 else (n_rows,)
      )
      _validate_type(axes, (list, tuple, np.ndarray, None), "axes")
      if axes is None:
          _, axes = plt.subplots(
              n_rows,
              n_columns,
              sharex=True,
              sharey=False,
              figsize=(8.8, 2.2 * n_rows),
              layout="constrained",
          )
      else:
          axes = np.array(axes)
      for ai, ax in enumerate(axes.flat):
          _validate_type(ax, plt.Axes, "axes.flat[%d]" % (ai,))
      if axes.shape != want_shape:
          raise ValueError(
              f"axes must have shape {want_shape}, got {axes.shape}."
          )
      fig = axes.flat[0].figure
      if n_columns > 1:
          suptitle = (
              'Whitened evoked (left, best estimator = "%s")\n'
              "and global field power "
              "(right, comparison of estimators)"
              % noise_cov[0].get("method", "empirical")
          )
          fig.suptitle(suptitle)
  
      if any(
          (
              (n_columns == 1 and n_ch_used >= 1),
              (n_columns == 2 and n_ch_used == 1),
          )
      ):
          axes_evoked = axes[:n_ch_used]
          ax_gfp = axes[-1:]
      elif n_columns == 2 and n_ch_used > 1:
          axes_evoked = axes[:n_ch_used, 0]
          ax_gfp = axes[:, 1]
      else:
          raise RuntimeError("Wrong axes inputs")
  
      titles_ = _handle_default("titles")
      if has_sss:
          titles_["meg"] = "MEG (combined)"
  
      colors = [
          plt.cm.Set1(i) for i in np.linspace(0, 0.5, len(noise_cov))
      ]
      ch_colors = _handle_default("color", None)
      iter_gfp = zip(evokeds_white, noise_cov, rank_list, colors)
  
      # the first is by law the best noise cov, on the left we plot that one.
      if not has_sss:
          evokeds_white[0].plot(
              unit=False,
              axes=axes_evoked,
              hline=[-1.96, 1.96],
              show=False,
              time_unit=time_unit,
              spatial_colors=False,
          )
      else:
          for (ch_type, picks), ax in zip(picks_list, axes_evoked):
              ax.plot(
                  times,
                  evokeds_white[0].data[picks].T,
                  color="k",
                  lw=0.5,
              )
              for hline in [-1.96, 1.96]:
                  ax.axhline(hline, color="red", linestyle="--", lw=2)
              ax.set(
                  title="%s (%d channel%s)"
                  % (titles_[ch_type], len(picks), _pl(len(picks)))
              )
  
      # Now plot the GFP for all covs if indicated.
      for evoked_white, noise_cov, rank_, color in iter_gfp:
          i = 0
  
          for ch, sub_picks in picks_list:
              this_rank = rank_[ch]
              title = "{} ({}{})".format(
                  titles_[ch] if n_columns > 1 else ch,
                  "rank " if n_columns > 1 else "",
                  this_rank,
              )
              label = noise_cov.get("method", "empirical")
  
              ax = ax_gfp[i]
              ax.set_title(
                  title
                  if n_columns > 1
                  else 'Whitened GFP, method = "%s"' % label
              )
  
              data = evoked_white.data[sub_picks]
              gfp = whitened_gfp(data, rank=this_rank)
              # Wrap SSS-processed data (MEG) to the mag color
              color_ch = "mag" if ch == "meg" else ch
              ax.plot(
                  times,
                  gfp,
                  label=label if n_columns > 1 else title,
                  color=color if n_columns > 1 else ch_colors[color_ch],
                  lw=0.5,
              )
              ax.set(
                  xlabel=f"Time ({time_unit})",
                  ylabel=r"GFP ($\chi^2$)",
                  xlim=[times[0], times[-1]],
                  ylim=(0, 10),
              )
              ax.axhline(1, color="red", linestyle="--", lw=2.0)
              if n_columns > 1:
                  i += 1
  
      ax = ax_gfp[0]
      if n_columns == 1:
          ax.legend(  # mpl < 1.2.1 compatibility: use prop instead of fontsize
              loc="upper right",
              bbox_to_anchor=(0.98, 0.9),
              prop=dict(size=12),
          )
      else:
          ax.legend(loc="upper right", prop=dict(size=10))
      fig.canvas.draw()
  
      plt_show(show)
      return fig
  
imports: from copy import deepcopy
  from functools import partial
  from itertools import cycle
  from numbers import Integral
  import numpy
  from .._fiff.pick import _DATA_CH_TYPES_SPLIT, _PICK_TYPES_DATA_DICT, _VALID_CHANNEL_TYPES, _picks_to_idx, channel_indices_by_type, channel_type, pick_info
  from ..defaults import _handle_default
  from ..fixes import _is_last_row
  from ..utils import _check_ch_locs, _check_if_nan, _clean_names, _is_numeric, _pl, _to_rgb, _validate_type, fill_doc, logger, verbose, warn
  from .topo import _plot_evoked_topo
  from .topomap import _check_sphere, _draw_outlines, _get_pos_outlines, _make_head_outlines, _prepare_topomap, _prepare_topomap_plot, _set_contour_locator, plot_topomap
  from .utils import DraggableColorbar, _check_cov, _check_delayed_ssp, _check_option, _check_time_unit, _draw_proj_checkbox, _get_cmap, _get_color_list, _make_combine_callable, _plot_masked_image, _prepare_joint_axes, _process_times, _prop_kw, _set_title_multiple_electrodes, _set_window_title, _setup_ax_spines, _setup_cmap, _setup_plot_projector, _setup_vmin_vmax, _triage_rank_sss, _trim_ticks, _validate_if_list_of_axes, plt_show
label_desc: Use image node_id 17 for calling a global function with example usage: plot_evoked_white(evoked, noise_cov, show, rank, time_unit, sphere, axes, verbose) and returns: fig, unknown