code: def plot_rank(
      study: Study,
      params: list[str] | None = None,
      *,
      target: Callable[[FrozenTrial], float] | None = None,
      target_name: str = "Objective Value",
  ) -> "go.Figure":
      """Plot parameter relations as scatter plots with colors indicating ranks of target value.
  
      Note that trials missing the specified parameters will not be plotted.
  
      Example:
  
          The following code snippet shows how to plot the parameter relationship as a rank plot.
  
          .. plotly::
  
              import optuna
  
  
              def objective(trial):
                  x = trial.suggest_float("x", -100, 100)
                  y = trial.suggest_categorical("y", [-1, 0, 1])
  
                  c0 = 400 - (x + y)**2
                  trial.set_user_attr("constraint", [c0])
  
                  return x ** 2 + y
  
  
              def constraints(trial):
                  return trial.user_attrs["constraint"]
  
  
              sampler = optuna.samplers.TPESampler(seed=10, constraints_func=constraints)
              study = optuna.create_study(sampler=sampler)
              study.optimize(objective, n_trials=30)
  
              fig = optuna.visualization.plot_rank(study, params=["x", "y"])
              fig.show()
  
      Args:
          study:
              A :class:`~optuna.study.Study` object whose trials are plotted for their target values.
          params:
              Parameter list to visualize. The default is all parameters.
          target:
              A function to specify the value to display. If it is :obj:`None` and ``study`` is being
              used for single-objective optimization, the objective values are plotted.
  
              .. note::
                  Specify this argument if ``study`` is being used for multi-objective optimization.
          target_name:
              Target's name to display on the color bar.
  
      Returns:
          A :class:`plotly.graph_objs.Figure` object.
  
      .. note::
          This function requires plotly >= 5.0.0.
      """
  
      _imports.check()
      info = _get_rank_info(study, params, target, target_name)
      return _get_rank_plot(info)
  
imports: from __future__ import annotations
  import math
  import typing
  from typing import Any
  from typing import Callable
  from typing import NamedTuple
  import numpy
  from optuna._experimental import experimental_func
  from optuna.logging import get_logger
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.study import Study
  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
  from optuna.visualization._utils import _is_log_scale
  from optuna.visualization._utils import _is_numerical
  from optuna.visualization.matplotlib._matplotlib_imports import _imports
label_desc: Use image node_id 1 for calling a global function with example usage: plot_rank(study, params) and returns: _get_rank_plot