code: def test_plot_white():
      """Test plot_white."""
      cov = read_cov(cov_fname)
      cov["method"] = "empirical"
      cov["projs"] = []  # avoid warnings
      evoked = _get_epochs().average()
      evoked.set_eeg_reference("average")  # Avoid warnings
  
      # test rank param.
      with pytest.raises(ValueError, match="exceeds"):
          evoked.plot_white(cov, rank={"mag": 10})
      evoked.plot_white(
          cov, rank={"mag": 1, "grad": 8, "eeg": 2}, time_unit="s"
      )
      fig = evoked.plot_white(
          cov, rank={"mag": 1}, time_unit="s"
      )  # test rank
      evoked.plot_white(
          cov, rank={"grad": 8}, time_unit="s", axes=fig.axes
      )
      with pytest.raises(
          ValueError, match=r"must have shape \(4,\), got \(2,"
      ):
          evoked.plot_white(cov, axes=fig.axes[:2])
      with pytest.raises(ValueError, match="When not using SSS"):
          evoked.plot_white(cov, rank={"meg": 306})
      evoked.plot_white([cov, cov], time_unit="s")
      plt.close("all")
  
      fig = plot_evoked_white(evoked, [cov, cov])
      assert len(fig.axes) == 3 * 2
      axes = np.array(fig.axes).reshape(3, 2)
      plot_evoked_white(evoked, [cov, cov], axes=axes)
      with pytest.raises(ValueError, match=r"have shape \(3, 2\), got"):
          plot_evoked_white(evoked, [cov, cov], axes=axes[:, :1])
  
      # Hack to test plotting of maxfiltered data
      evoked_sss = _get_epochs(picks="meg").average()
      sss = dict(sss_info=dict(in_order=80, components=np.arange(80)))
      with evoked_sss.info._unlock():
          evoked_sss.info["proc_history"] = [dict(max_info=sss)]
      evoked_sss.plot_white(cov, rank={"meg": 64})
      with pytest.raises(ValueError, match="When using SSS"):
          evoked_sss.plot_white(cov, rank={"grad": 201})
      evoked_sss.plot_white(cov, time_unit="s")
  
imports: from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib import gridspec
  from matplotlib.collections import PolyCollection
  from matplotlib.colors import same_color
  from mpl_toolkits.axes_grid1.parasite_axes import HostAxes
  from numpy.testing import assert_allclose
  import mne
  from mne import Epochs, compute_covariance, compute_proj_evoked, make_fixed_length_events, read_cov, read_events
  from mne._fiff.constants import FIFF
  from mne.datasets import testing
  from mne.io import read_raw_fif
  from mne.stats.parametric import _parametric_ci
  from mne.utils import catch_logging
  from mne.viz import plot_compare_evokeds, plot_evoked_white
  from mne.viz.utils import _fake_click, _get_cmap
label_desc: Use image node_id 9 for calling a global function with example usage: test_plot_white() without return types