code: def _draw_colorbar_pce(
      ax, colors, cmap, colorbar_title, colorbar_ticks
  ):
      """Draw colorbar for plot_compare_evokeds."""
      from matplotlib.colorbar import ColorbarBase
      from matplotlib.transforms import Bbox
      from mpl_toolkits.axes_grid1 import make_axes_locatable
  
      # create colorbar axes
      orig_bbox = ax.get_position()
      divider = make_axes_locatable(ax)
      cax = divider.append_axes("right", size="5%", pad=0.1)
      cax.yaxis.tick_right()
      cb = ColorbarBase(
          cax, cmap=cmap, norm=None, orientation="vertical"
      )
      cb.set_label(colorbar_title)
      # handle ticks
      ticks = sorted(set(colorbar_ticks.values()))
      ticklabels = [""] * len(ticks)
      for label, tick in colorbar_ticks.items():
          idx = ticks.index(tick)
          if len(
              ticklabels[idx]
          ):  # handle labels with the same color/location
              ticklabels[idx] = "\n".join([ticklabels[idx], label])
          else:
              ticklabels[idx] = label
      assert all(len(label) for label in ticklabels)
      cb.set_ticks(ticks)
      cb.set_ticklabels(ticklabels)
      # shrink colorbar if discrete colors
      color_vals = set(colors.values())
      if all([isinstance(_color, Integral) for _color in color_vals]):
          fig = ax.get_figure()
          fig.canvas.draw()
          fig_aspect = np.divide(*fig.get_size_inches())
          new_bbox = ax.get_position()
          cax_width = 0.75 * (orig_bbox.xmax - new_bbox.xmax)
          # add extra space for multiline colorbar labels
          h_mult = max(
              2, max([len(label.split("\n")) for label in ticklabels])
          )
          cax_height = len(color_vals) * h_mult * cax_width / fig_aspect
          x0 = orig_bbox.xmax - cax_width
          y0 = (new_bbox.ymax + new_bbox.ymin - cax_height) / 2
          x1 = orig_bbox.xmax
          y1 = y0 + cax_height
          new_bbox = Bbox([[x0, y0], [x1, y1]])
          cax.set_axes_locator(None)
          cax.set_position(new_bbox)
  
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 28 for calling a global function with example usage: _draw_colorbar_pce(ax, colors, cmap, colorbar_title, colorbar_ticks) without return types