code: def prepare_xy_chart(
      disparity_df,
      x_metric,
      y_metric,
      attribute,
      fairness_threshold,
      chart_height,
      chart_width,
      chart_default_sizes,
      accessibility_mode,
  ):
      metrics = __sanitize_metrics([x_metric, y_metric])
  
      x_metric = metrics[0]
      y_metric = metrics[1]
  
      __validate_data_inputs(
          disparity_df, metrics, attribute, fairness_threshold
      )
  
      if (chart_width is None) and (chart_height is None):
          chart_width = chart_default_sizes.full_side
          chart_height = chart_default_sizes.full_side
      elif chart_width is None:
          chart_width = chart_height
      elif chart_height is None:
          chart_height = chart_width
  
      Validator.chart_size_xy(chart_width, chart_height)
  
      # REF GROUP DEFINITION
      ## ref_group is taken from x_metric as long as it's not part of the metrics that
      ## do not have disparity variables (such as prev)
      if x_metric in Validator.NON_DISPARITY_METRICS_LIST:
          ref_group = disparity_df[
              disparity_df["attribute_name"] == attribute
          ].iloc[0][f"{y_metric}_ref_group_value"]
      else:
          ref_group = disparity_df[
              disparity_df["attribute_name"] == attribute
          ].iloc[0][f"{x_metric}_ref_group_value"]
  
      plot_table = __filter_df(
          disparity_df, metrics, attribute, xy_plot=True
      )
  
      # SCALES
      global_scales = __get_global_scales(
          plot_table,
          ref_group,
          metrics,
          chart_height,
          accessibility_mode,
      )
  
      # SELECTION
      interactive_selection_group = alt.selection_multi(
          empty="all", fields=["attribute_value"]
      )
  
      return (
          plot_table,
          x_metric,
          y_metric,
          ref_group,
          global_scales,
          chart_height,
          chart_width,
          interactive_selection_group,
      )
  
file_path: aequitas/src/aequitas/plot/commons/initializers.py
imports: import altair
  from aequitas.plot.commons import validators
  from aequitas.plot.commons import scales
  from aequitas.plot.commons.helpers import to_list, calculate_chart_size_from_elements
label_desc: Use image node_id 8 for calling a global function with example usage: prepare_xy_chart(disparity_df, x_metric, y_metric, attribute, fairness_threshold, chart_height, chart_width, chart_default_sizes, accessibility_mode) and returns: plot_table,  x_metric,  y_metric,  ref_group,  global_scales,  chart_height,  chart_width,  interactive_selection_group