code: def plot_horizontal_bar(
      data_dict,
      multiclass=False,
      title="",
      xtitle="",
      ytitle="",
      start_zero=False,
  ):
      if data_dict.get("scores", None) is None:  # pragma: no cover
          return None
      scores = data_dict["scores"].copy()
      names = data_dict["names"].copy()
      values = data_dict.get("values", None)
      if values is not None:
          values = data_dict["values"].copy()
          names = _names_with_values(names, values)
      if data_dict.get("perf", None) is not None and title == "":
          title_items = []
  
          predicted = data_dict["perf"]["predicted"]
          actual = data_dict["perf"]["actual"]
          predicted_score = data_dict["perf"]["predicted_score"]
          actual_score = data_dict["perf"]["actual_score"]
  
          if (
              "meta" in data_dict and "label_names" in data_dict["meta"]
          ):  # Classification titles
              label_names = data_dict["meta"]["label_names"]
              predicted = label_names[predicted]
  
              title_str = ""
  
              if not np.isnan(actual):
                  actual_class = label_names[actual]
                  title_str += f"Actual Class: {actual_class} | "
  
              title_str += f"Predicted Class: {predicted}"
              title_str += (
                  f"<br />Pr(y = {predicted}): {predicted_score:.3f}"
              )
  
              if (
                  not np.isnan(actual)
                  and len(set([predicted, actual])) == 2
              ):
                  title_str += (
                      f" | Pr(y = {actual}): {actual_score:.3f}"
                  )
              title_items.append(title_str)
          else:  # Regression titles
              if not np.isnan(actual):
                  actual_score = _pretty_number(actual_score)
                  title_items.append("Actual: {}".format(actual_score))
  
              predicted_score = _pretty_number(predicted_score)
              title_items.append(
                  "Predicted: {}".format(predicted_score)
              )
  
          title = " | ".join(title_items)
      if not multiclass:
          # color by positive/negative:
          color = [
              COLORS[0] if value <= 0 else COLORS[1] for value in scores
          ]
      else:
          color = []
      extra = data_dict.get("extra", None)
      if extra is not None:
          scores.extend(extra["scores"])
          names.extend(extra["names"])
          if values is not None:
              values.extend(extra["values"])
          color.extend([COLORS[2]] * len(extra["scores"]))
      x = scores
      y = names
      traces = []
      if multiclass:
          for index, cls in enumerate(data_dict["meta"]["label_names"]):
              trace_scores = [x[index] for x in data_dict["scores"]] + [
                  data_dict["extra"]["scores"][0][index]
              ]
              trace_names = data_dict["names"] + [
                  data_dict["extra"]["names"]
              ]
              traces.append(
                  go.Bar(
                      y=trace_names,
                      x=trace_scores,
                      orientation="h",
                      name=cls,
                  )
              )
      else:
          traces.append(
              go.Bar(
                  x=x, y=y, orientation="h", marker=dict(color=color)
              )
          )
  
      if start_zero:
          x_range = [0, np.max(x)]
      else:
          max_abs_x = np.max(np.abs(x))
          if multiclass:
              max_abs_x = np.sum(np.array(x), axis=1)
          x_range = [-max_abs_x, max_abs_x]
      layout = dict(
          title=title,
          yaxis=dict(automargin=True, title=ytitle, dtick=1),
          xaxis=dict(range=x_range, title=xtitle),
      )
      if multiclass:
          layout["barmode"] = "relative"
      figure = go.Figure(data=traces, layout=layout)
      return figure
  
imports: import plotly.graph_objs
  import numpy
  from plotly import subplots
  import matplotlib.pyplot
  from numbers import Number
  import logging
label_desc: Use image node_id 13 for calling a global function with example usage: plot_horizontal_bar(data_dict, multiclass, title, xtitle, ytitle, start_zero) and returns: figure, None