code: def plot_objective_vs_constraints(
      model: ModelBridge,
      objective: str,
      subset_metrics: Optional[List[str]] = None,
      generator_runs_dict: TNullableGeneratorRunsDict = None,
      rel: bool = True,
      infer_relative_constraints: Optional[bool] = False,
      fixed_features: Optional[ObservationFeatures] = None,
      data_selector: Optional[Callable[[Observation], bool]] = None,
      color_parameter: Optional[str] = None,
      color_metric: Optional[str] = None,
      label_dict: Optional[Dict[str, str]] = None,
  ) -> AxPlotConfig:
      """Plot the tradeoff between an objective and all other metrics in a model.
  
      All arms used in the model are included in the plot. Additional
      arms can be passed through via the `generator_runs_dict` argument.
  
      Fixed features input can be used to override fields of the insample arms
      when making model predictions.
  
      Args:
          model: model to draw predictions from.
          objective: metric to optimize. Plotted on the x-axis.
          subset_metrics: list of metrics to plot on the y-axes
              if need a subset of all metrics in the model.
          generator_runs_dict: a mapping from
              generator run name to generator run.
          rel: if True, use relative effects. Default is True.
          infer_relative_constraints: if True, read relative spec from model's
              optimization config. Absolute constraints will not be relativized;
              relative ones will be.
              Objectives will respect the `rel` parameter.
              Metrics that are not constraints will be relativized.
          fixed_features: Fixed features to use when making model predictions.
          data_selector: Function for selecting observations for plotting.
          color_parameter: color points according to the specified parameter,
              cannot be used together with color_metric.
          color_metric: color points according to the specified metric,
              cannot be used together with color_parameter.
          label_dict: A dictionary that maps the label to
              an alias to be used in the plot.
      """
      if color_parameter or color_metric:
          layout_offset_x = 0.15
      else:
          layout_offset_x = 0
      if subset_metrics is not None:
          metrics = subset_metrics
      else:
          metrics = [m for m in model.metric_names if m != objective]
      if not label_dict:
          _check_label_lengths(metrics + [objective])
  
      metric_dropdown = []
  
      if infer_relative_constraints:
          rels = infer_is_relative(
              model, metrics, non_constraint_rel=rel
          )
          if rel:
              rels[objective] = True
          else:
              rels[objective] = False
      else:
          if rel:
              rels = {metric: True for metric in metrics}
              rels[objective] = True
          else:
              rels = {metric: False for metric in metrics}
              rels[objective] = False
  
      # set plotted data to the first outcome
      plot_data = _multiple_metric_traces(
          model,
          objective,
          metrics[0],
          generator_runs_dict,
          rel_x=rels[objective],
          rel_y=rels[metrics[0]],
          fixed_features=fixed_features,
          data_selector=data_selector,
          color_parameter=color_parameter,
          color_metric=color_metric,
      )
  
      for metric in metrics:
          otraces = _multiple_metric_traces(
              model,
              objective,
              metric,
              generator_runs_dict,
              rel_x=rels[objective],
              rel_y=rels[metric],
              fixed_features=fixed_features,
              data_selector=data_selector,
              color_parameter=color_parameter,
              color_metric=color_metric,
          )
  
          # Current version of Plotly does not allow updating the yaxis label
          # on dropdown (via relayout) simultaneously with restyle
          metric_dropdown.append(
              {
                  "args": [
                      {
                          "y": [t["y"] for t in otraces],
                          "error_y.array": [
                              t["error_y"]["array"] for t in otraces
                          ],
                          "text": [
                              _replace_str(t["text"], label_dict)
                              for t in otraces
                          ],
                      },
                      {
                          "yaxis.title": _replace_str(
                              metric, label_dict
                          )
                          + (" (%)" if rels[metric] else ""),
                      },
                  ],
                  "label": _replace_str(metric, label_dict),
                  "method": "update",
              }
          )
  
      num_cand_traces = (
          len(generator_runs_dict)
          if generator_runs_dict is not None
          else 0
      )
  
      layout = go.Layout(
          title="Objective Tradeoffs",
          hovermode="closest",
          updatemenus=[
              {
                  "x": 1.25 + layout_offset_x,
                  "y": 0.62,
                  "buttons": [
                      {
                          "args": [
                              {
                                  "error_x.width": 4,
                                  "error_x.thickness": 2,
                                  "error_y.width": 4,
                                  "error_y.thickness": 2,
                              }
                          ],
                          "label": "Yes",
                          "method": "restyle",
                      },
                      {
                          "args": [
                              {
                                  "error_x.width": 0,
                                  "error_x.thickness": 0,
                                  "error_y.width": 0,
                                  "error_y.thickness": 0,
                              }
                          ],
                          "label": "No",
                          "method": "restyle",
                      },
                  ],
                  "yanchor": "middle",
                  "xanchor": "left",
              },
              {
                  "x": 1.25 + layout_offset_x,
                  "y": 0.52,
                  "buttons": [
                      {
                          "args": [
                              {
                                  "visible": (
                                      [False, True]
                                      + [True] * num_cand_traces
                                  )
                              }
                          ],
                          "label": "Modeled",
                          "method": "restyle",
                      },
                      {
                          "args": [
                              {
                                  "visible": (
                                      [True, False]
                                      + [False] * num_cand_traces
                                  )
                              }
                          ],
                          "label": "Observed",
                          "method": "restyle",
                      },
                  ],
                  "yanchor": "middle",
                  "xanchor": "left",
              },
              {
                  "x": 1.25 + layout_offset_x,
                  "y": 0.72,
                  "yanchor": "middle",
                  "xanchor": "left",
                  "buttons": metric_dropdown,
              },
          ],
          annotations=[
              {
                  "x": 1.18 + layout_offset_x,
                  "y": 0.72,
                  "xref": "paper",
                  "yref": "paper",
                  "text": "Y-Axis",
                  "showarrow": False,
                  "yanchor": "middle",
              },
              {
                  "x": 1.18 + layout_offset_x,
                  "y": 0.62,
                  "xref": "paper",
                  "yref": "paper",
                  "text": "Show CI",
                  "showarrow": False,
                  "yanchor": "middle",
              },
              {
                  "x": 1.18 + layout_offset_x,
                  "y": 0.52,
                  "xref": "paper",
                  "yref": "paper",
                  "text": "Type",
                  "showarrow": False,
                  "yanchor": "middle",
              },
          ],
          xaxis={
              "title": _replace_str(objective, label_dict)
              + (" (%)" if rels[objective] else ""),
              "zeroline": True,
              "zerolinecolor": "red",
          },
          yaxis={
              "title": _replace_str(metrics[0], label_dict)
              + (" (%)" if rels[metrics[0]] else ""),
              "zeroline": True,
              "zerolinecolor": "red",
          },
          width=900,
          height=600,
          font={"size": 10},
          legend={"x": 1 + layout_offset_x},
      )
  
      fig = go.Figure(data=plot_data, 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 5 for calling a global function with example usage: plot_objective_vs_constraints(model, objective, subset_metrics, generator_runs_dict, rel, infer_relative_constraints, fixed_features, data_selector, color_parameter, color_metric, label_dict) and returns: AxPlotConfig