code: def plot_fitted(
      model: ModelBridge,
      metric: str,
      generator_runs_dict: TNullableGeneratorRunsDict = None,
      rel: bool = True,
      custom_arm_order: Optional[List[str]] = None,
      custom_arm_order_name: str = "Custom",
      show_CI: bool = True,
      data_selector: Optional[Callable[[Observation], bool]] = None,
      scalarized_metric_config: Optional[List[Dict[str, Any]]] = None,
  ) -> AxPlotConfig:
      """Plot fitted metrics.
  
      Args:
          model: model to use for predictions.
          metric: metric to plot predictions for.
          generator_runs_dict: a mapping from
              generator run name to generator run.
          rel: if True, use relative effects. Default is True.
          custom_arm_order: a list of arm names in the
              order corresponding to how they should be plotted on the x-axis.
              If not None, this is the default ordering.
          custom_arm_order_name: name for custom ordering to
              show in the ordering dropdown. Default is 'Custom'.
          show_CI: if True, render confidence intervals.
          data_selector: Function for selecting observations for plotting.
          scalarized_metric_config: An optional list of dicts specifying how to aggregate
              multiple metrics into a single scalarized metric. For each dict, the key is
              the name of the new scalarized metric, and the value is a dictionary mapping
              each metric to its weight. e.g.
              {"name": "metric1:agg", "weight": {"metric1_c1": 0.5, "metric1_c2": 0.5}}.
      """
      traces = _single_metric_traces(
          model,
          metric,
          generator_runs_dict,
          rel,
          show_CI=show_CI,
          data_selector=data_selector,
          scalarized_metric_config=scalarized_metric_config,
      )
  
      # order arm name sorting arm numbers within batch
      names_by_arm = sorted(
          np.unique(np.concatenate([d["x"] for d in traces])),
          key=lambda x: arm_name_to_tuple(x),
      )
  
      # get arm names sorted by effect size
      names_by_effect = list(
          OrderedDict.fromkeys(
              np.concatenate([d["x"] for d in traces])
              .flatten()
              .take(
                  np.argsort(
                      np.concatenate([d["y"] for d in traces]).flatten()
                  )
              )
          )
      )
  
      # options for ordering arms (x-axis)
      xaxis_categoryorder = "array"
      xaxis_categoryarray = names_by_arm
  
      order_options = [
          {
              "args": [
                  {
                      "xaxis.categoryorder": "array",
                      "xaxis.categoryarray": names_by_arm,
                  }
              ],
              "label": "Name",
              "method": "relayout",
          },
          {
              "args": [
                  {
                      "xaxis.categoryorder": "array",
                      "xaxis.categoryarray": names_by_effect,
                  }
              ],
              "label": "Effect Size",
              "method": "relayout",
          },
      ]
  
      # if a custom order has been passed, default to that
      if custom_arm_order is not None:
          xaxis_categoryorder = "array"
          xaxis_categoryarray = custom_arm_order
          order_options = [
              {
                  "args": [
                      {
                          "xaxis.categoryorder": "array",
                          "xaxis.categoryarray": custom_arm_order,
                      }
                  ],
                  "label": custom_arm_order_name,
                  "method": "relayout",
              }
              # Union[List[str...
          ] + order_options
  
      layout = go.Layout(
          title="Predicted Outcomes",
          hovermode="closest",
          updatemenus=[
              {
                  "x": 1.25,
                  "y": 0.67,
                  "buttons": list(order_options),
                  "yanchor": "middle",
                  "xanchor": "left",
              }
          ],
          yaxis={
              "zerolinecolor": "red",
              "title": "{}{}".format(metric, " (%)" if rel else ""),
          },
          xaxis={
              "tickangle": 45,
              "categoryorder": xaxis_categoryorder,
              "categoryarray": xaxis_categoryarray,
          },
          annotations=[
              {
                  "x": 1.18,
                  "y": 0.72,
                  "xref": "paper",
                  "yref": "paper",
                  "text": "Sort By",
                  "showarrow": False,
                  "yanchor": "middle",
              }
          ],
          font={"size": 10},
      )
  
      fig = go.Figure(data=traces, layout=layout)
      return AxPlotConfig(data=fig, plot_type=AxPlotTypes.GENERIC)
  
imports: import numbers
  import warnings
  from collections import OrderedDict
  from logging import Logger
  from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import numpy
  import plotly.graph_objs
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.observation import Observation, ObservationFeatures
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.registry import Models
  from ax.plot.base import AxPlotConfig, AxPlotTypes, CI_OPACITY, DECIMALS, PlotInSampleArm, PlotMetric, PlotOutOfSampleArm, Z
  from ax.plot.color import BLUE_SCALE, COLORS, DISCRETE_COLOR_SCALE, rgba
  from ax.plot.helper import _format_CI, _format_dict, _wrap_metric, arm_name_to_sort_key, arm_name_to_tuple, get_plot_data, infer_is_relative, resize_subtitles, TNullableGeneratorRunsDict
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast_optional
  from ax.utils.stats.statstools import relativize
  from plotly import subplots
label_desc: Use image node_id 10 for calling a global function with example usage: plot_fitted(model, metric, generator_runs_dict, rel, custom_arm_order, custom_arm_order_name, show_CI, data_selector, scalarized_metric_config) and returns: AxPlotConfig