code: def _autoset_axis_limits(
      y: np.ndarray,
      optimization_direction: str,
      force_include_value: Optional[float] = None,
  ) -> List[float]:
      """Provides automatic axis limits based on the data and optimization direction.
      All best points are included in this range, and by default the worst points are
      truncated at some distance below the median, where that distance is given by
      1.5 * (the distance between the median and the best quartile).
  
      If `force_include_value` is provided, the worst points will be truncated at this
      value if it is worse than the truncation point described above.
      """
      # TODO: replace interpolation->method once it becomes standard.
      q1 = np.percentile(y, q=25, interpolation="lower").min()
      q2_min = np.percentile(y, q=50, interpolation="linear").min()
      q2_max = np.percentile(y, q=50, interpolation="linear").max()
      q3 = np.percentile(y, q=75, interpolation="higher").max()
      if optimization_direction == "minimize":
          y_lower = y.min()
          y_upper = q2_max + 1.5 * (q2_max - q1)
          if force_include_value is not None:
              y_upper = max(y_upper, force_include_value)
      else:
          y_lower = q2_min - 1.5 * (q3 - q2_min)
          y_upper = y.max()
          if force_include_value is not None:
              y_lower = min(y_lower, force_include_value)
      y_padding = 0.1 * (y_upper - y_lower)
      y_lower, y_upper = y_lower - y_padding, y_upper + y_padding
      return [y_lower, y_upper]
  
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 9 for calling a global function with example usage: _autoset_axis_limits(y, optimization_direction, force_include_value) and returns: list