class_docstr: Plotting object allows for visualization of absolute group bias metrics and
  relative disparities calculated by Aequitas Group(), Bias(), and Fairness()
  class instances.
docstr: This function plots absolute group metrics as indicated by the config file,
  colored based on calculated parity.
  
  :param fairness_table: fairness table. Output of a Fairness.get_fairness
      function.
  :param group_metric: the fairness metric to plot. Must be a column in the fairness_table.
  :param ax: a matplotlib Axis. If not passed a new figure will be created.
  :param ax_lim: maximum value on x-axis, used to match axes across subplots
      when plotting multiple metrics. Default is None.
  :param title: whether to include a title in visualizations. Default is True.
  :param label_dict: optional dictionary of replacement values for data.
      Default is None.
  :param min_group_size: minimum proportion of total group size (all data)
      a population group must meet in order to be included in fairness
      visualization
  
  :return: A Matplotlib axis
code: def plot_fairness_group(
      self,
      fairness_table,
      group_metric,
      ax=None,
      ax_lim=None,
      title=False,
      label_dict=None,
      min_group_size=None,
  ):
      """
      This function plots absolute group metrics as indicated by the config file,
      colored based on calculated parity.
  
      :param fairness_table: fairness table. Output of a Fairness.get_fairness
          function.
      :param group_metric: the fairness metric to plot. Must be a column in the fairness_table.
      :param ax: a matplotlib Axis. If not passed a new figure will be created.
      :param ax_lim: maximum value on x-axis, used to match axes across subplots
          when plotting multiple metrics. Default is None.
      :param title: whether to include a title in visualizations. Default is True.
      :param label_dict: optional dictionary of replacement values for data.
          Default is None.
      :param min_group_size: minimum proportion of total group size (all data)
          a population group must meet in order to be included in fairness
          visualization
  
      :return: A Matplotlib axis
      """
      model_id = self._check_model_id(
          df=fairness_table, method_table_name="fairness_table"
      )
  
      if group_metric not in fairness_table.columns:
          raise ValueError(
              f"Specified disparity metric {group_metric} not "
              f"in 'fairness_table'."
          )
  
      if fairness_table[group_metric].isnull().any():
          raise ValueError(
              f"Cannot plot {group_metric}, has NaN values."
          )
  
      if ax is None:
          fig, ax = plt.subplots(figsize=(10, 5))
  
      height_of_bar = 1
      attributes = fairness_table.attribute_name.unique()
      tick_indices = []
      next_bar_height = 0
  
      if min_group_size:
          if min_group_size > (
              fairness_table.group_size.max()
              / fairness_table.group_size.sum()
          ):
              raise ValueError(
                  f"'min_group_size' proportion specified: '{min_group_size}' "
                  f"is larger than all groups in sample."
              )
  
          min_size = min_group_size * fairness_table.group_size.sum()
          fairness_table = fairness_table.loc[
              fairness_table["group_size"] >= min_size
          ]
  
      label_position_values = collections.deque(
          fairness_table[group_metric].values
      )
  
      # Lock absolute value metric plot x-axis to (0, 1)
      if not ax_lim:
          ax_lim = 1
      ax.set_xlim(0, ax_lim)
  
      for attribute in attributes:
          attribute_data = fairness_table.loc[
              fairness_table["attribute_name"] == attribute
          ]
          values = attribute_data[group_metric].values
          grp_sizes = attribute_data["group_size"].values
  
          # apply red for "False" fairness determinations and green for "True"
          # determinations
          cb_green = "#1b7837"
          cb_red = "#a50026"
          parity = self._metric_parity_mapping[group_metric]
          parity_colors = [
              cb_green if val else cb_red
              for val in attribute_data[parity]
          ]
  
          # Set white text for red bars and black text for green bars
          label_colors = [
              (0, 0, 0, 1) if val == True else (1, 1, 1, 1)
              for val in attribute_data[parity]
          ]
  
          attribute_indices = np.arange(
              next_bar_height,
              next_bar_height + attribute_data.shape[0],
              step=height_of_bar,
          )
  
          attribute_tick_location = (
              float(
                  (
                      min(attribute_indices)
                      + max(attribute_indices)
                      + height_of_bar
                  )
              )
              / 2
          )
  
          h_attribute = ax.barh(
              attribute_indices,
              width=values,
              color=parity_colors,
              align="edge",
              edgecolor="grey",
              alpha=0.8,
          )
  
          if label_dict:
              labels = [
                  label_dict.get(label, label)
                  for label in attribute_data["attribute_value"].values
              ]
          else:
              labels = attribute_data["attribute_value"].values
  
          for y, label, value, text_color, g_size in zip(
              attribute_indices, labels, values, label_colors, grp_sizes
          ):
              next_position = label_position_values.popleft()
              group_label = f"{label} (Num: {g_size:,})"
  
              if ax_lim < 3:
                  CHAR_PLACEHOLDER = 0.03
              else:
                  CHAR_PLACEHOLDER = 0.25
  
              label_length = len(group_label) * CHAR_PLACEHOLDER
              max_val_length = 7 * CHAR_PLACEHOLDER
              indent_length = ax_lim * 0.025
  
              # bar long enough for label, enough space after bar for value
              if (
                  (indent_length + label_length)
                  < (next_position - indent_length)
              ) and (
                  (next_position + indent_length + max_val_length)
                  < (ax_lim - indent_length)
              ):
                  ax.text(
                      next_position + indent_length,
                      y + float(height_of_bar) / 2,
                      f"{value:.2f}",
                      fontsize=12,
                      verticalalignment="top",
                  )
                  ax.text(
                      indent_length,
                      y + float(height_of_bar) / 2,
                      group_label,
                      fontsize=11,
                      verticalalignment="top",
                      color=text_color,
                  )
  
              # case when bar too long for labels after bar, print all text in bar
              elif (next_position + indent_length + max_val_length) > (
                  ax_lim - indent_length
              ):
                  ax.text(
                      indent_length,
                      y + float(height_of_bar) / 2,
                      f"{group_label}, {value:.2f}",
                      fontsize=11,
                      verticalalignment="top",
                      color=text_color,
                  )
  
              # case when bar too small for labels inside bar, print all text
              # after bar
              else:
                  ax.text(
                      next_position + indent_length,
                      y + float(height_of_bar) / 2,
                      f"{group_label}, {value:.2f}",
                      fontsize=12,
                      verticalalignment="top",
                  )
  
          tick_indices.append((attribute, attribute_tick_location))
          next_bar_height = max(attribute_indices) + 2 * height_of_bar
  
      ax.yaxis.set_ticks(list(map(lambda x: x[1], tick_indices)))
      ax.yaxis.set_ticklabels(
          list(map(lambda x: x[0], tick_indices)), fontsize=14
      )
      ax.set_axisbelow(True)
      ax.xaxis.grid(
          color="lightgray", which="major", linestyle="dashed"
      )
  
      ax.set_xlabel("Absolute Metric Magnitude")
  
      if title:
          ax.set_title(f"{group_metric.upper()}", fontsize=20)
  
      return ax
  
imports: import logging
  import math
  import numpy
  import collections
  import seaborn
  import matplotlib.pyplot
  import matplotlib.colors
  import matplotlib.cm
  from aequitas import squarify_flipped
label_desc: Use image node_id 17 for calling the Plot obj's underlying member method code with example usage: obj.plot_fairness_group(fairness_table, group_metric, ax, ax_lim, title, label_dict, min_group_size) and returns: ax