code: def _imshow_tfr(
      ax,
      ch_idx,
      tmin,
      tmax,
      vmin,
      vmax,
      onselect,
      ylim=None,
      tfr=None,
      freq=None,
      x_label=None,
      y_label=None,
      colorbar=False,
      cmap=("RdBu_r", True),
      yscale="auto",
      mask=None,
      mask_style="both",
      mask_cmap="Greys",
      mask_alpha=0.1,
      is_jointplot=False,
      cnorm=None,
  ):
      """Show time-frequency map as two-dimensional image."""
      from matplotlib import pyplot as plt
      from matplotlib.widgets import RectangleSelector
  
      _check_option("yscale", yscale, ["auto", "linear", "log"])
  
      cmap, interactive_cmap = cmap
      times = np.linspace(tmin, tmax, num=tfr[ch_idx].shape[1])
  
      img, t_end = _plot_masked_image(
          ax,
          tfr[ch_idx],
          times,
          mask,
          yvals=freq,
          cmap=cmap,
          vmin=vmin,
          vmax=vmax,
          mask_style=mask_style,
          mask_alpha=mask_alpha,
          mask_cmap=mask_cmap,
          yscale=yscale,
          cnorm=cnorm,
      )
  
      if x_label is not None:
          ax.set_xlabel(x_label)
      if y_label is not None:
          ax.set_ylabel(y_label)
      if colorbar:
          if isinstance(colorbar, DraggableColorbar):
              cbar = colorbar.cbar  # this happens with multiaxes case
          else:
              cbar = plt.colorbar(mappable=img, ax=ax)
          if interactive_cmap:
              ax.CB = DraggableColorbar(
                  cbar, img, kind="tfr_image", ch_type=None
              )
      ax.RS = RectangleSelector(
          ax, onselect=onselect
      )  # reference must be kept
  
      return t_end
  
imports: from copy import deepcopy
  from functools import partial
  import numpy
  from scipy import ndimage
  from .._fiff.pick import channel_type, pick_types
  from ..defaults import _handle_default
  from ..utils import Bunch, _check_option, _clean_names, _is_numeric, _to_rgb, fill_doc
  from .utils import DraggableColorbar, _check_cov, _check_delayed_ssp, _draw_proj_checkbox, _plot_masked_image, _setup_ax_spines, _setup_vmin_vmax, add_background_image, plt_show
label_desc: Use image node_id 8 for calling a global function with example usage: _imshow_tfr(ax, ch_idx, tmin, tmax, vmin, vmax, onselect, ylim, tfr, freq, x_label, y_label, colorbar, cmap, yscale, mask, mask_style, mask_cmap, mask_alpha, is_jointplot, cnorm) and returns: t_end