code: def test_plot_spectrum(kind, array, request):
      """Test plotting (Epochs)Spectrum(Array)."""
      spectrum = request.getfixturevalue(f"{kind}_spectrum")
      if array:
          data, freqs = spectrum.get_data(return_freqs=True)
          Klass = (
              SpectrumArray if kind == "raw" else EpochsSpectrumArray
          )
          spectrum = Klass(data=data, info=spectrum.info, freqs=freqs)
      spectrum.info["bads"] = spectrum.ch_names[:1]  # one grad channel
      spectrum.plot(average=True, amplitude=True, spatial_colors=True)
      spectrum.plot(average=True, amplitude=False, spatial_colors=False)
      n_grad = sum(
          ch_type == "grad" for ch_type in spectrum.get_channel_types()
      )
      for amp, sc in ((True, True), (False, False)):
          fig = spectrum.plot(
              average=False,
              amplitude=amp,
              spatial_colors=sc,
              exclude=(),
          )
          lines = fig.axes[0].lines[2:]  # grads, ignore two vlines
          assert len(lines) == n_grad
          bad_color = "0.5" if sc else "r"
          n_bad = sum(
              same_color(line.get_color(), bad_color) for line in lines
          )
          assert n_bad == 1
      spectrum.plot_topo()
      spectrum.plot_topomap()
  
imports: from functools import partial
  import numpy
  import pytest
  from matplotlib.colors import same_color
  from numpy.testing import assert_array_equal
  from mne import Annotations
  from mne.time_frequency import read_spectrum
  from mne.time_frequency.spectrum import EpochsSpectrumArray, SpectrumArray
label_desc: Use image node_id 18 for calling a global function with example usage: test_plot_spectrum(kind, array, request) without return types