code: def plot_xy_metrics_chart(
      disparity_df,
      x_metric,
      y_metric,
      attribute,
      fairness_threshold=1.25,
      chart_height=None,
      chart_width=None,
      accessibility_mode=False,
  ):
      """Draws XY scatterplot, with the group_size encoded in the bubble size, based on the two metrics provided.
      Additionally draws threshold rules and bands if the fairness_threshold value is not None.
  
      :param disparity_df: a dataframe generated by the Aequitas Bias class
      :type disparity_df: pandas.core.frame.DataFrame
      :param x_metric: a metric to plot in the x axis
      :type x_metric: str
      :param y_metric: a metric to plot in the y axis
      :type y_metric: str
      :param attribute: an attribute to plot
      :type attribute: str
      :param fairness_threshold: a value for the maximum allowed disparity, defaults to 1.25
      :type fairness_threshold: float, optional
      :param chart_height: a value (in pixels) for the height of the chart
      :type chart_height: int, optional
      :param chart_width: a value (in pixels) for the width of the chart
      :type chart_width: int, optional
      :param accessibility_mode: a switch for the display of more accessible visual elements, defaults to False
      :type accessibility_mode: bool, optional
  
      :return: the full scatterplot chart
      :rtype: Altair chart object
      """
  
      (
          plot_table,
          x_metric,
          y_metric,
          ref_group,
          global_scales,
          chart_height,
          chart_width,
          interactive_selection_group,
      ) = Initializer.prepare_xy_chart(
          disparity_df,
          x_metric,
          y_metric,
          attribute,
          fairness_threshold,
          chart_height,
          chart_width,
          XY_Chart,
          accessibility_mode,
      )
  
      position_scales = __get_position_scales(chart_height, chart_width)
  
      scales = dict(global_scales, **position_scales)
  
      # AXIS RULES
      axis_rules = __draw_axis_rules(x_metric, y_metric, scales)
  
      # TICK LABELS
      tick_labels = __draw_tick_labels(
          scales, chart_height, chart_width
      )
  
      # INITIATE CHART
      chart = axis_rules + tick_labels
  
      # THRESHOLD AND BANDS
      if fairness_threshold is not None:
          # REF VALUES
          ref_group_index = plot_table.loc[
              plot_table["attribute_value"] == ref_group
          ].index
  
          x_ref_group_value = plot_table.loc[
              ref_group_index, x_metric
          ].iloc[0]
          y_ref_group_value = plot_table.loc[
              ref_group_index, y_metric
          ].iloc[0]
  
          # Y AXIS
          if y_metric not in Validator.NON_DISPARITY_METRICS_LIST:
              y_thresholds = __draw_threshold_bands(
                  ref_group_value=y_ref_group_value,
                  fairness_threshold=fairness_threshold,
                  main_scale=scales["y"],
                  aux_scale=scales["x"],
                  accessibility_mode=accessibility_mode,
              )
  
              chart += y_thresholds
  
          # X AXIS
          if x_metric not in Validator.NON_DISPARITY_METRICS_LIST:
              x_thresholds = __draw_threshold_bands(
                  ref_group_value=x_ref_group_value,
                  fairness_threshold=fairness_threshold,
                  main_scale=scales["x"],
                  aux_scale=scales["y"],
                  accessibility_mode=accessibility_mode,
                  drawing_x=True,
              )
  
              chart += x_thresholds
  
      # LEGEND
      legend = draw_legend(
          scales, interactive_selection_group, chart_width
      )
  
      # BUBBLES
      bubbles = __draw_bubbles(
          plot_table,
          x_metric,
          y_metric,
          ref_group,
          scales,
          interactive_selection_group,
      )
  
      # FINISH CHART COMPOSITION
      chart += legend + bubbles
  
      # CONFIGURATION
      styled_chart = (
          chart.configure_view(strokeWidth=0)
          .properties(
              height=chart_height,
              width=chart_width,
              title=f"{y_metric.upper()} by {x_metric.upper()} on {attribute.title()}",
              padding=XY_Chart.full_chart_padding,
              usermeta=get_chart_metadata("scatter_chart"),
          )
          .configure_title(
              font=FONT,
              fontWeight=Chart_Title.font_weight,
              fontSize=Chart_Title.font_size,
              color=Chart_Title.font_color,
              anchor=Chart_Title.anchor,
          )
          .configure_axis(
              titleFont=FONT,
              titleColor=Scatter_Axis.title_color,
              titleFontSize=Scatter_Axis.title_font_size,
              titleFontWeight=Scatter_Axis.title_font_weight,
              titleAngle=Scatter_Axis.title_angle,
          )
          .resolve_scale(
              y="independent", x="independent", size="independent"
          )
          .resolve_axis(x="shared", y="shared")
      )
  
      return styled_chart
  
file_path: aequitas/src/aequitas/plot/xy_metrics_chart.py
imports: import altair
  import pandas
  from aequitas.plot.commons.helpers import no_axis, get_chart_metadata
  from aequitas.plot.commons.legend import draw_legend
  from aequitas.plot.commons.scales import get_chart_size_range
  from aequitas.plot.commons.tooltips import get_tooltip_text_group_size
  from aequitas.plot.commons.style.classes import Threshold_Band, Threshold_Rule, Rule, Bubble, Scatter_Axis, Chart_Title, Axis
  from aequitas.plot.commons.style.text import FONT
  from aequitas.plot.commons.style.sizes import XY_Chart
  from aequitas.plot.commons import initializers
  from aequitas.plot.commons import validators
  from aequitas.plot.commons import labels
label_desc: Use image node_id 6 for calling a global function with example usage: plot_xy_metrics_chart(disparity_df, x_metric, y_metric, attribute, fairness_threshold, chart_height, chart_width, accessibility_mode) and returns: styled_chart