code: def plot_drop_log(
      drop_log,
      threshold=0,
      n_max_plot=20,
      subject=None,
      color="lightgray",
      width=0.8,
      ignore=("IGNORED",),
      show=True,
  ):
      """Show the channel stats based on a drop_log from Epochs.
  
      Parameters
      ----------
      drop_log : list of list
          Epoch drop log from Epochs.drop_log.
      threshold : float
          The percentage threshold to use to decide whether or not to
          plot. Default is zero (always plot).
      n_max_plot : int
          Maximum number of channels to show stats for.
      subject : str | None
          The subject name to use in the title of the plot. If ``None``, do not
          display a subject name.
  
          .. versionchanged:: 0.23
             Added support for ``None``.
  
          .. versionchanged:: 1.0
             Defaults to ``None``.
      color : tuple | str
          Color to use for the bars.
      width : float
          Width of the bars.
      ignore : list
          The drop reasons to ignore.
      show : bool
          Show figure if True.
  
      Returns
      -------
      fig : instance of matplotlib.figure.Figure
          The figure.
      """
      import matplotlib.pyplot as plt
  
      from ..epochs import _drop_log_stats
  
      percent = _drop_log_stats(drop_log, ignore)
      if percent < threshold:
          logger.info(
              "Percent dropped epochs < supplied threshold; not "
              "plotting drop log."
          )
          return
      absolute = len(
          [
              x
              for x in drop_log
              if len(x)
              if not any(y in ignore for y in x)
          ]
      )
      n_epochs_before_drop = len(
          [x for x in drop_log if not any(y in ignore for y in x)]
      )
  
      scores = Counter(
          [ch for d in drop_log for ch in d if ch not in ignore]
      )
      ch_names = np.array(list(scores.keys()))
      counts = np.array(list(scores.values()))
      # init figure, handle easy case (no drops)
      fig, ax = plt.subplots(layout="constrained")
      title = (
          f"{absolute} of {n_epochs_before_drop} epochs removed "
          f"({percent:.1f}%)"
      )
      if subject is not None:
          title = f"{subject}: {title}"
      ax.set_title(title)
      if len(ch_names) == 0:
          ax.text(0.5, 0.5, "No drops", ha="center", fontsize=14)
          return fig
      # count epochs that aren't fully caught by `ignore`
      n_used = sum(
          [
              any(ch not in ignore for ch in d) or len(d) == 0
              for d in drop_log
          ]
      )
      # calc plot values
      n_bars = min(n_max_plot, len(ch_names))
      x = np.arange(n_bars)
      y = 100 * counts / n_used
      order = np.flipud(np.argsort(y))
      ax.bar(
          x, y[order[:n_bars]], color=color, width=width, align="center"
      )
      ax.set_xticks(x)
      ax.set_xticklabels(
          ch_names[order[:n_bars]],
          rotation=45,
          size=10,
          horizontalalignment="right",
      )
      ax.set_ylabel("% of epochs removed")
      ax.grid(axis="y")
      plt_show(show)
      return fig
  
file_path: mne-python/mne/viz/epochs.py
imports: from collections import Counter
  from copy import deepcopy
  import numpy
  from scipy.ndimage import gaussian_filter1d
  from .._fiff.meas_info import create_info
  from .._fiff.pick import _DATA_CH_TYPES_SPLIT, _VALID_CHANNEL_TYPES, _picks_to_idx
  from ..defaults import _handle_default
  from ..fixes import _sharex
  from ..utils import _check_option, fill_doc, legacy, logger, verbose, warn
  from ..utils.spectrum import _split_psd_kwargs
  from .raw import _setup_channel_selections
  from .utils import DraggableColorbar, _check_cov, _compute_scalings, _get_channel_plotting_order, _handle_decim, _handle_precompute, _make_combine_callable, _make_event_color_dict, _set_title_multiple_electrodes, _set_window_title, _setup_cmap, _setup_vmin_vmax, _validate_type, plt_show
label_desc: Use image node_id 5 for calling a global function with example usage: plot_drop_log(drop_log, threshold, n_max_plot, subject, color, width, ignore, show) and returns: fig, fig