code: def _plot_hbar(
      exp_values: np.ndarray,
      exp_feature_names: List[str],
      exp_target_names: List[str],
      features: List[int],
      targets: List[Union[str, int]],
      n_cols: int = 3,
      sort: bool = True,
      top_k: Optional[int] = None,
      title: str = "",
      ax: Optional[Union["plt.Axes", np.ndarray]] = None,
      bar_kw: Optional[dict] = None,
      fig_kw: Optional[dict] = None,
  ) -> "plt.Axes":
      """
      Horizontal bar plot.
  
      Parameters
      ----------
      exp_values
          Explanation values to be plotted.
      exp_feature_names
          A list of explanation feature names. Used as the y-axis labels.
      exp_target_names
          A list of explanation target names. Determines the number of plots (i.e., one for each target).
      features, targets, n_cols, sort, top_k, ax, bar_kw, fig_kw
          See :py:meth:`alibi.explainers.pd_variance.plot_pd_variance`
      title
          The title of the bar plot.
  
      Returns
      -------
      `plt.Axes` with the values plot.
      """
      from matplotlib.gridspec import GridSpec
  
      default_fig_kw = {"tight_layout": "tight"}
      if fig_kw is None:
          fig_kw = {}
  
      fig_kw = {**default_fig_kw, **fig_kw}
  
      # set feature indices
      feature_indices, feature_names = features, []
      for ifeatures in features:
          feature_names.append(exp_feature_names[ifeatures])
  
      # set target indices
      target_indices, target_names = [], []
      for target in targets:
          if isinstance(target, str):
              target_idx = exp_target_names.index(target)
              target_name = target
          else:
              target_idx = target
              target_name = exp_target_names[target]
  
          target_indices.append(target_idx)
          target_names.append(target_name)
  
      # create axes
      if ax is None:
          fig, ax = plt.subplots()
  
      # number of targets will correspond to the number of axis
      n_targets = len(target_names)
  
      if isinstance(ax, plt.Axes) and n_targets != 1:
          ax.set_axis_off()  # treat passed axis as a canvas for subplots
          fig = ax.figure  # type: ignore[assignment]
          n_cols = min(n_cols, n_targets)
          n_rows = math.ceil(n_targets / n_cols)
          axes = np.empty((n_rows, n_cols), dtype=object)
          axes_ravel = axes.ravel()
          gs = GridSpec(n_rows, n_cols)
  
          for i, spec in enumerate(list(gs)[:n_targets]):  # type: ignore[call-overload]
              axes_ravel[i] = fig.add_subplot(spec)
      else:
          if isinstance(ax, plt.Axes):
              ax = np.array(ax)
          if ax.size < n_targets:
              raise ValueError(
                  f"Expected ax to have {n_targets} axes, got {ax.size}"
              )
          axes = np.atleast_2d(ax)
          axes_ravel = axes.ravel()
          fig = axes_ravel[0].figure
  
      for i, (target_index, target_name, ax) in enumerate(
          zip(target_indices, target_names, axes_ravel)
      ):
          width = exp_values[target_index][feature_indices]
          y_labels = feature_names
  
          if sort:
              sorted_indices = np.argsort(width)[::-1][:top_k]
              width = width[sorted_indices]
              y_labels = [y_labels[j] for j in sorted_indices]
  
          y = np.arange(len(width))
          default_bar_kw = {"align": "center"}
          bar_kw = (
              default_bar_kw
              if bar_kw is None
              else {**default_bar_kw, **bar_kw}
          )
  
          ax.barh(y=y, width=width, **bar_kw)  # type: ignore[union-attr,arg-type]
          ax.set_yticks(y)  # type: ignore[union-attr]
          ax.set_yticklabels(y_labels)  # type: ignore[union-attr]
          ax.invert_yaxis()  # type: ignore[union-attr] # labels read top-to-bottom
          ax.set_xlabel(title)  # type: ignore[union-attr]
          ax.set_title(target_name)  # type: ignore[union-attr]
  
      fig.set(**fig_kw)
      return axes
  
imports: import copy
  import itertools
  import logging
  import math
  import numbers
  import sys
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from sklearn.base import BaseEstimator
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_DATA_PDVARIANCE, DEFAULT_META_PDVARIANCE
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers import plot_pd
  from alibi.explainers.partial_dependence import Kind, PartialDependence, TreePartialDependence
  from alibi.utils import _get_options_string
label_desc: Use image node_id 1 for calling a global function with example usage: _plot_hbar(exp_values, exp_feature_names, exp_target_names, features, targets, n_cols, sort, top_k, title, ax, bar_kw, fig_kw) and returns: axes