code: def _get_improvement_plot(
      info: _ImprovementInfo, min_n_trials: int
  ) -> "go.Figure":
      n_trials = len(info.trial_numbers)
  
      fig = go.Figure(
          layout=go.Layout(
              title="Terminator Improvement Plot",
              xaxis=dict(title="Trial"),
              yaxis=dict(title="Terminator Improvement"),
          )
      )
      if n_trials == 0:
          _logger.warning("There are no complete trials.")
          return fig
  
      fig.add_trace(
          _get_improvement_scatter(
              info.trial_numbers[: min_n_trials + 1],
              info.improvements[: min_n_trials + 1],
              # Plot line with a lighter color until the number of trials reaches min_n_trials.
              OPACITY,
              n_trials <= min_n_trials,  # Avoid showing legend twice.
          )
      )
  
      if n_trials > min_n_trials:
          fig.add_trace(
              _get_improvement_scatter(
                  info.trial_numbers[min_n_trials:],
                  info.improvements[min_n_trials:],
              )
          )
  
      fig.add_trace(_get_error_scatter(info.trial_numbers, info.errors))
  
      fig.update_yaxes(range=_get_y_range(info, min_n_trials))
      return fig
  
imports: from __future__ import annotations
  from typing import NamedTuple
  import tqdm
  import optuna
  from optuna._experimental import experimental_func
  from optuna.logging import get_logger
  from optuna.study.study import Study
  from optuna.terminator import BaseErrorEvaluator
  from optuna.terminator import BaseImprovementEvaluator
  from optuna.terminator import CrossValidationErrorEvaluator
  from optuna.terminator import RegretBoundEvaluator
  from optuna.terminator.improvement.evaluator import DEFAULT_MIN_N_TRIALS
  from optuna.visualization._plotly_imports import _imports
label_desc: Use image node_id 6 for calling a global function with example usage: _get_improvement_plot(info, min_n_trials) and returns: fig, fig