code: def map_data_multiple_metrics_dropdown_plotly(
      title: str,
      metric_names: List[str],
      xs_by_metric: Dict[str, List[np.ndarray]],
      ys_by_metric: Dict[str, List[np.ndarray]],
      legend_labels_by_metric: Dict[str, List[str]],
      stopping_markers_by_metric: Dict[str, List[bool]],
      xlabels_by_metric: Dict[str, str],
      lower_is_better_by_metric: Dict[str, Optional[bool]],
      opacity: float = 0.75,
      color_map: str = "viridis",
      autoset_axis_limits: bool = True,
  ) -> go.Figure:
      """Plot map data traces for multiple metrics, controlled by a dropdown.
      Each button in the dropdown reveals the plot for a different metric.
  
      Args:
          title: Title of the plot.
          metric_names: List of metric names.
          xs_by_metric: Maps metric names to a list of x-value arrays.
          ys_by_metric: Maps metric names to a list of y-value arrays.
          legend_labels_by_metric: Maps metric names to legend labels.
          stopping_markers_by_metric: Maps metric names to a list of
              boolean values indicating whether a trace should be plotted
              with a stopping marker.
          xlabels_by_metric: Maps metric names to xlabels.
          lower_is_better_by_metric: Maps metric names to `lower_is_better`
          opacity: The opacity to use when plotting traces.
          color_map: The color map for plotting different trials.
          autoset_axis_limits: Whether to automatically set axis limits.
      """
      data = []
      trace_ranges = (
          {}
      )  # maps metric names to range of associated traces
      layout_yaxis_ranges = {}  # maps metric names to y-axis ranges
      for i, metric_name in enumerate(metric_names):
          colors = sample_colorscale(
              colorscale=color_map,
              samplepoints=np.linspace(
                  1.0, 0.0, len(xs_by_metric[metric_name])
              ),
              colortype="tuple",
          )
          metric_traces = []
          for x, y, legend_label, plot_stopping_marker, color in zip(
              xs_by_metric[metric_name],
              ys_by_metric[metric_name],
              legend_labels_by_metric[metric_name],
              stopping_markers_by_metric[metric_name],
              colors,
          ):
              metric_traces.extend(
                  map_data_single_trace_scatters(
                      x=x,
                      y=y,
                      xlabel=xlabels_by_metric[metric_name],
                      ylabel=metric_name,
                      legend_label=legend_label,
                      plot_stopping_marker=plot_stopping_marker,
                      opacity=opacity,
                      visible=(i == 0),
                      trace_color=color,
                  )
              )
          trace_ranges[metric_name] = (
              len(data),
              len(data) + len(metric_traces),
          )
          data.extend(metric_traces)
          lower_is_better = lower_is_better_by_metric[metric_name]
          if autoset_axis_limits and lower_is_better is not None:
              layout_yaxis_ranges[metric_name] = _autoset_axis_limits(
                  y=np.concatenate(ys_by_metric[metric_name]),
                  optimization_direction="minimize"
                  if lower_is_better
                  else "maximize",
              )
          else:
              layout_yaxis_ranges[metric_name] = None
  
      metric_dropdown = []
      for metric_name in metric_names:
          is_visible = [False] * len(data)
          metric_start, metric_end = trace_ranges[metric_name]
          is_visible[metric_start:metric_end] = [True] * (
              metric_end - metric_start
          )
          metric_dropdown.append(
              {
                  "args": [
                      {"visible": is_visible},
                      {
                          "yaxis.range": layout_yaxis_ranges[
                              metric_name
                          ],
                          "yaxis.title": metric_name,
                          "xaxis.title": xlabels_by_metric[metric_name],
                      },
                  ],
                  "label": metric_name,
                  "method": "update",
              }
          )
      layout = go.Layout(
          title=title,
          showlegend=True,
          yaxis={"title": metric_names[0]},
          xaxis={"title": xlabels_by_metric[metric_names[0]]},
          updatemenus=[
              {
                  "active": 0,
                  "buttons": metric_dropdown,
                  "yanchor": "top",
                  "xanchor": "left",
                  "x": 0,
                  "y": 1.125,
              },
          ],
      )
      return go.Figure(
          layout=layout,
          data=data,
          layout_yaxis_range=layout_yaxis_ranges[metric_names[0]],
      )
  
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 2 for calling a global function with example usage: map_data_multiple_metrics_dropdown_plotly(title, metric_names, xs_by_metric, ys_by_metric, legend_labels_by_metric, stopping_markers_by_metric, xlabels_by_metric, lower_is_better_by_metric, opacity, color_map, autoset_axis_limits) and returns: go