code: def squarify_plot_rects(
      rects,
      norm_x=100,
      norm_y=100,
      color=None,
      labels=None,
      values=None,
      ax=None,
      acronyms=False,
      **kwargs,
  ):
      """
      Plotting with Matplotlib from predefined rectangles. Adapted from squarify
      source code.
  
      :param rects: list-like of dictionaries indicating rectangle dimensions
          for plotting
      :param norm_x:  overall figure dimensions for normalizing value box sizes
      :param norm_y: overall figure dimensions for normalizing value box sizes
      :param color: color string or list-like of colors to use for value boxes
      :param labels: list-like used as label text
      :param values: list-like used as value text
      :param ax: Matplotlib Axes instance
      :param kwargs: dict, keyword arguments passed to matplotlib.Axes.bar
  
      :return: matplotlib.Axis
      """
      x = [rect["x"] for rect in rects]
      y = [rect["y"] for rect in rects]
      dx = [rect["dx"] for rect in rects]
      dy = [rect["dy"] for rect in rects]
  
      ax.bar(
          x,
          dy,
          width=dx,
          bottom=y,
          color=color,
          label=labels,
          align="edge",
          **kwargs,
      )
  
      INDENT_LENGTH = 4
      CHAR_PLACEHOLDER = 1.5
  
      if values is not None:
          va = "center" if labels is None else "top"
          if values:
              plot_ready_values = [
                  val
                  if isinstance(val, str)
                  else f"{val:.2}"
                  if isinstance(val, (int, float))
                  else ""
                  for val in values
              ]
  
          for val, r in zip(plot_ready_values, rects):
              x, y, dx, dy = r["x"], r["y"], r["dx"], r["dy"]
  
              # if box large enough, add labels and values
              if (
                  dx
                  >= (INDENT_LENGTH * 2) + (CHAR_PLACEHOLDER * len(val))
              ) & (dx > 10):
                  ax.text(
                      x + dx / 2,
                      y + dy / 2,
                      val,
                      va=va,
                      ha="center",
                      fontsize=12,
                  )
  
      if labels is not None:
          va = "center" if values is None else "bottom"
          under_plot = []
          alphabet = list(map(chr, range(65, 91)))
          under_plot_num = 0
  
          if values:
              plot_ready_values = [
                  val
                  if isinstance(val, str)
                  else f"{val:.2}"
                  if isinstance(val, (int, float))
                  else ""
                  for val in values
              ]
          else:
              plot_ready_values = itertools.repeat(None)
  
          for label, r, val in zip(labels, rects, plot_ready_values):
              x, y, dx, dy = r["x"], r["y"], r["dx"], r["dy"]
              length = dx
  
              # if box large enough, add labels and values
              if (
                  dx
                  >= (INDENT_LENGTH * 2) + CHAR_PLACEHOLDER * len(label)
              ) & (dx > 10):
                  ax.text(
                      x + dx / 2,
                      y + dy / 2,
                      label,
                      va=va,
                      ha="center",
                      fontsize=14,
                      wrap=False,
                  )
  
              else:
                  # add labels that don't fit in boxes underneath plot
                  if acronyms:
                      # use acronym to to label very small boxes
                      acronym = "".join(
                          [word[0] for word in str(label).split(" ")]
                      )
  
                      # add labels that don't fit in boxes underneath plot
                      ax.text(
                          x + dx / 2,
                          y + dy / 2,
                          acronym,
                          va=va,
                          ha="center",
                          fontsize=12,
                          wrap=False,
                      )
  
                      underplot_label = (
                          str(label)
                          if val is None
                          else f"{label}, {val}"
                      )
                      under_plot.append(f"{acronym}: {underplot_label}")
  
                  else:
                      # use alphabet character to to label very small boxes
                      ax.text(
                          x + dx / 2,
                          y + dy / 2,
                          alphabet[under_plot_num],
                          va=va,
                          ha="center",
                          fontsize=12,
                          wrap=False,
                      )
  
                      underplot_label = (
                          str(label)
                          if val is None
                          else f"{label}, {val}"
                      )
                      under_plot.append(
                          f"{alphabet[under_plot_num]}: {underplot_label}"
                      )
                      under_plot_num += 1
  
          if len(under_plot) > 0:
              unlabeled = ("\n").join(under_plot)
              ax.text(
                  0.0,
                  -0.05,
                  f"Not labeled above:\n{unlabeled}",
                  ha="left",
                  va="top",
                  transform=ax.transAxes,
                  fontsize=14,
              )
  
      ax.set_xlim(0, norm_x)
      ax.set_ylim(0, norm_y)
      return ax
  
file_path: aequitas/src/aequitas/squarify_flipped.py
imports: import matplotlib.pyplot
  import itertools
label_desc: Use image node_id 12 for calling a global function with example usage: squarify_plot_rects(rects, norm_x, norm_y, color, labels, values, ax, acronyms) and returns: ax