code: def test_plot_raw_traces(raw, events, browser_backend):
      """Test plotting of raw data."""
      ismpl = browser_backend.name == "matplotlib"
      with raw.info._unlock():
          raw.info[
              "lowpass"
          ] = 10.0  # allow heavy decim during plotting
      fig = raw.plot(
          events=events,
          order=[1, 7, 5, 2, 3],
          n_channels=3,
          group_by="original",
      )
      assert hasattr(
          fig, "mne"
      )  # make sure fig.mne param object is present
      if ismpl:
          assert len(fig.axes) == 5
  
      # setup
      x = fig.mne.traces[0].get_xdata()[5]
      y = fig.mne.traces[0].get_ydata()[5]
      hscroll = fig.mne.ax_hscroll
      vscroll = fig.mne.ax_vscroll
      # test marking bad channels
      label = fig._get_ticklabels("y")[0]
      assert label not in fig.mne.info["bads"]
      # click data to mark bad
      fig._fake_click((x, y), xform="data")
      assert label in fig.mne.info["bads"]
      # click data to unmark bad
      fig._fake_click((x, y), xform="data")
      assert label not in fig.mne.info["bads"]
      # click name to mark bad
      fig._click_ch_name(ch_index=0, button=1)
      assert label in fig.mne.info["bads"]
      # test other kinds of clicks
      fig._fake_click((0.5, 0.98))  # click elsewhere (add vline)
      assert fig.mne.vline_visible is True
      fig._fake_click((0.5, 0.98), button=3)  # remove vline
      assert fig.mne.vline_visible is False
      fig._fake_click((0.5, 0.5), ax=hscroll)  # change time
      t_start = fig.mne.t_start
      fig._fake_click(
          (0.5, 0.5), ax=hscroll
      )  # shouldn't change time this time
      assert round(t_start, 6) == round(fig.mne.t_start, 6)
      # test scrolling through channels
      labels = fig._get_ticklabels("y")
      assert labels == [
          raw.ch_names[1],
          raw.ch_names[7],
          raw.ch_names[5],
      ]
      fig._fake_click((0.5, 0.05), ax=vscroll)  # change channels to end
      labels = fig._get_ticklabels("y")
      assert labels == [
          raw.ch_names[5],
          raw.ch_names[2],
          raw.ch_names[3],
      ]
      for _ in (0, 0):
          # first click changes channels to mid; second time shouldn't change
          # This needs to be changed for Qt, because there scrollbars are
          # drawn differently (value of slider at lower end, not at middle)
          yclick = 0.5 if ismpl else 0.7
          fig._fake_click((0.5, yclick), ax=vscroll)
          labels = fig._get_ticklabels("y")
          assert labels == [
              raw.ch_names[7],
              raw.ch_names[5],
              raw.ch_names[2],
          ]
  
      # test clicking a channel name in butterfly mode
      bads = fig.mne.info["bads"].copy()
      fig._fake_keypress("b")
      fig._click_ch_name(ch_index=0, button=1)  # should be no-op
      assert fig.mne.info["bads"] == bads  # unchanged
      fig._fake_keypress("b")
  
      # test starting up in zen mode
      fig = plot_raw(raw, show_scrollbars=False)
      # test order, title, & show_options kwargs
      with pytest.raises(
          ValueError, match="order should be array-like; got"
      ):
          raw.plot(order="foo")
      with pytest.raises(
          TypeError, match="title must be None or a string, got"
      ):
          raw.plot(title=1)
      raw.plot(show_options=True)
      browser_backend._close_all()
  
      # annotations outside data range
      annot = Annotations(
          [10, 10 + raw.first_samp / raw.info["sfreq"]],
          [10, 10],
          ["test", "test"],
          raw.info["meas_date"],
      )
      with pytest.warns(RuntimeWarning, match="outside data range"):
          raw.set_annotations(annot)
  
      # Color setting
      with pytest.raises(
          KeyError, match="must be strictly positive, or -1"
      ):
          raw.plot(event_color={0: "r"})
      with pytest.raises(
          TypeError, match="event_color key must be an int, got"
      ):
          raw.plot(event_color={"foo": "r"})
      plot_raw(raw, events=events, event_color={-1: "r", 998: "b"})
  
imports: import itertools
  import os
  from copy import deepcopy
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib import backend_bases
  from numpy.testing import assert_allclose
  from mne import Annotations, create_info, pick_types
  from mne._fiff.pick import _DATA_CH_TYPES_ORDER_DEFAULT, _PICK_TYPES_DATA_DICT
  from mne.annotations import _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray
  from mne.utils import _assert_no_instances, _dt_to_stamp, _record_warnings, check_version, get_config, set_config
  from mne.viz import plot_raw, plot_sensors
  from mne.viz.utils import _fake_click, _fake_keypress
label_desc: Use image node_id 17 for calling a global function with example usage: test_plot_raw_traces(raw, events, browser_backend) without return types