code: def plot_objective_value_vs_trial_index(
      exp_df: pd.DataFrame,
      metric_colname: str,
      minimize: bool,
      title: Optional[str] = None,
      hover_data_colnames: Optional[List[str]] = None,
      autoset_axis_limits: bool = True,
  ) -> go.Figure:
      """Returns a plotly figure showing the optimization trace for a single metric.
  
      Args:
          exp_df: DataFrame with the following columns
              - "trial_index": Index of each trial.
              - "arm_name": Name of each arm evaluated in the corresponding trial.
              - metric_colname: Name of the objective metric (user-provided).
              - "is_feasible": Whether each arm is feasible (optional). If not
                  provided, all arms will be considered feasible.
              - "generation_method": Generation method used to generate each arm
                  (optional).
              - hover_data_colnames: Columns to be displayed on hover (user-provided).
          metric_colname: Name of the column in exp_df that contains the
              objective metric values.
          minimize: Optimization direction of the objective.
          title: Title of the plot (optional).
          hover_data_colnames: Names of additional columns to display on hover.
          autoset_axis_limits: Automatically try to set the limit for each axis to focus
              on the region of interest. Will always include first point.
      Returns:
          Optimization trace as a plot.
      """
      # Protect input exp_df from changes.
      exp_df = exp_df.copy()
  
      # Use completed trials only.
      trial_status_colname = "trial_status"
      if trial_status_colname in exp_df.columns:
          exp_df = exp_df.loc[
              exp_df[trial_status_colname].str.match("COMPLETED")
          ]
  
      # Check if feasibility and generation method columns exist.
      is_feasible_colname = (
          "is_feasible" if "is_feasible" in exp_df.columns else None
      )
      generation_method_colname = (
          "generation_method"
          if "generation_method" in exp_df.columns
          else None
      )
  
      scatter = px.scatter(
          data_frame=exp_df,
          x="trial_index",
          y=metric_colname,
          color=is_feasible_colname,
          symbol=generation_method_colname,
          hover_name="arm_name",
          hover_data=hover_data_colnames,
      )
      running_feasible_optimum_df = compute_running_feasible_optimum_df(
          exp_df=exp_df,
          metric_colname=metric_colname,
          minimize=minimize,
          is_feasible_colname=is_feasible_colname,
      )
      line = px.line(
          data_frame=running_feasible_optimum_df,
          x="trial_index",
          y="running_optimum",
          color="Legend",
          line_shape="hv",
      )
      # pyre-ignore[16]: `go.graph_objs.Figure` has no attribute add_trace.
      fig = scatter.add_trace(line.data[0])
      if autoset_axis_limits:
          layout_yaxis_range = _autoset_axis_limits(
              y=exp_df[metric_colname].to_numpy(),
              optimization_direction="minimize"
              if minimize
              else "maximize",
              force_include_value=running_feasible_optimum_df.loc[
                  0, metric_colname
              ],
          )
          fig.update_layout(yaxis_range=layout_yaxis_range)
      if title is not None:
          fig.update_layout(title=title)
      return fig
  
imports: from datetime import datetime, timedelta
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  import plotly.graph_objs
  from ax.core.experiment import Experiment
  from ax.plot.base import AxPlotConfig, AxPlotTypes
  from ax.plot.color import COLORS, DISCRETE_COLOR_SCALE, rgba
  from ax.utils.common.timeutils import timestamps_in_range
  from ax.utils.common.typeutils import not_none
  from plotly import express
  from plotly.express.colors import sample_colorscale
label_desc: Use image node_id 14 for calling a global function with example usage: plot_objective_value_vs_trial_index(exp_df, metric_colname, minimize, title, hover_data_colnames, autoset_axis_limits) and returns: fig