code: def _get_optimization_history_plot(
      info_list: list[_OptimizationHistoryInfo],
      target_name: str,
  ) -> "go.Figure":
      layout = go.Layout(
          title="Optimization History Plot",
          xaxis={"title": "Trial"},
          yaxis={"title": target_name},
      )
  
      traces = []
      for trial_numbers, values_info, best_values_info in info_list:
          infeasible_trial_numbers = [
              n
              for n, s in zip(trial_numbers, values_info.states)
              if s == _ValueState.Infeasible
          ]
          if values_info.stds is None:
              error_y = None
              feasible_trial_numbers = [
                  num
                  for num, s in zip(trial_numbers, values_info.states)
                  if s == _ValueState.Feasible
              ]
              feasible_trial_values = []
              for num in feasible_trial_numbers:
                  feasible_trial_values.append(values_info.values[num])
              infeasible_trial_values = []
              for num in infeasible_trial_numbers:
                  infeasible_trial_values.append(
                      values_info.values[num]
                  )
          else:
              if (
                  _ValueState.Infeasible in values_info.states
                  or _ValueState.Incomplete in values_info.states
              ):
                  _logger.warning(
                      "Your study contains infeasible trials. "
                      "In optimization history plot, "
                      "error bars are calculated for only feasible trial values."
                  )
              error_y = {
                  "type": "data",
                  "array": values_info.stds,
                  "visible": True,
              }
              feasible_trial_numbers = trial_numbers
              feasible_trial_values = values_info.values
              infeasible_trial_values = []
          traces.append(
              go.Scatter(
                  x=feasible_trial_numbers,
                  y=feasible_trial_values,
                  error_y=error_y,
                  mode="markers",
                  name=values_info.label_name,
              )
          )
          if best_values_info is not None:
              traces.append(
                  go.Scatter(
                      x=trial_numbers,
                      y=best_values_info.values,
                      name=best_values_info.label_name,
                      mode="lines",
                  )
              )
              if best_values_info.stds is not None:
                  upper = np.array(best_values_info.values) + np.array(
                      best_values_info.stds
                  )
                  traces.append(
                      go.Scatter(
                          x=trial_numbers,
                          y=upper,
                          mode="lines",
                          line=dict(width=0.01),
                          showlegend=False,
                      )
                  )
                  lower = np.array(best_values_info.values) - np.array(
                      best_values_info.stds
                  )
                  traces.append(
                      go.Scatter(
                          x=trial_numbers,
                          y=lower,
                          mode="none",
                          showlegend=False,
                          fill="tonexty",
                          fillcolor="rgba(255,0,0,0.2)",
                      )
                  )
          traces.append(
              go.Scatter(
                  x=infeasible_trial_numbers,
                  y=infeasible_trial_values,
                  error_y=error_y,
                  mode="markers",
                  name="Infeasible Trial",
                  marker={"color": "#cccccc"},
                  showlegend=False,
              )
          )
      return go.Figure(data=traces, layout=layout)
  
imports: from __future__ import annotations
  from collections.abc import Callable
  from collections.abc import Sequence
  from enum import Enum
  import math
  from typing import cast
  from typing import NamedTuple
  import numpy
  from optuna.logging import get_logger
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.study import Study
  from optuna.study._study_direction import StudyDirection
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
  from optuna.visualization._plotly_imports import _imports
  from optuna.visualization._utils import _check_plot_args
label_desc: Use image node_id 3 for calling a global function with example usage: _get_optimization_history_plot(info_list, target_name) and returns: go