code: def _get_rank_plot(
      info: _RankPlotInfo,
  ) -> "go.Figure":
      params = info.params
      sub_plot_infos = info.sub_plot_infos
  
      layout = go.Layout(title=f"Rank ({info.target_name})")
  
      if len(params) == 0:
          return go.Figure(data=[], layout=layout)
      if len(params) == 2:
          x_param = params[0]
          y_param = params[1]
          sub_plot_info = sub_plot_infos[0][0]
          sub_plots = _get_rank_subplot(
              sub_plot_info, info.target_name, info.has_custom_target
          )
  
          figure = go.Figure(data=sub_plots, layout=layout)
          figure.update_xaxes(
              title_text=x_param, range=sub_plot_info.xaxis.range
          )
          figure.update_yaxes(
              title_text=y_param, range=sub_plot_info.yaxis.range
          )
  
          if sub_plot_info.xaxis.is_cat:
              figure.update_xaxes(type="category")
          if sub_plot_info.yaxis.is_cat:
              figure.update_yaxes(type="category")
  
          if sub_plot_info.xaxis.is_log:
              log_range = [
                  math.log10(p) for p in sub_plot_info.xaxis.range
              ]
              figure.update_xaxes(range=log_range, type="log")
          if sub_plot_info.yaxis.is_log:
              log_range = [
                  math.log10(p) for p in sub_plot_info.yaxis.range
              ]
              figure.update_yaxes(range=log_range, type="log")
      else:
          figure = make_subplots(
              rows=len(params),
              cols=len(params),
              shared_xaxes=True,
              shared_yaxes=True,
              horizontal_spacing=0.08 / len(params),
              vertical_spacing=0.08 / len(params),
          )
  
          figure.update_layout(layout)
          for x_i, x_param in enumerate(params):
              for y_i, y_param in enumerate(params):
                  scatter = _get_rank_subplot(
                      sub_plot_infos[y_i][x_i],
                      info.target_name,
                      info.has_custom_target,
                  )
                  figure.add_trace(scatter, row=y_i + 1, col=x_i + 1)
  
                  xaxis = sub_plot_infos[y_i][x_i].xaxis
                  yaxis = sub_plot_infos[y_i][x_i].yaxis
                  figure.update_xaxes(
                      range=xaxis.range, row=y_i + 1, col=x_i + 1
                  )
                  figure.update_yaxes(
                      range=yaxis.range, row=y_i + 1, col=x_i + 1
                  )
  
                  if xaxis.is_cat:
                      figure.update_xaxes(
                          type="category", row=y_i + 1, col=x_i + 1
                      )
                  if yaxis.is_cat:
                      figure.update_yaxes(
                          type="category", row=y_i + 1, col=x_i + 1
                      )
  
                  if xaxis.is_log:
                      log_range = [math.log10(p) for p in xaxis.range]
                      figure.update_xaxes(
                          range=log_range,
                          type="log",
                          row=y_i + 1,
                          col=x_i + 1,
                      )
                  if yaxis.is_log:
                      log_range = [math.log10(p) for p in yaxis.range]
                      figure.update_yaxes(
                          range=log_range,
                          type="log",
                          row=y_i + 1,
                          col=x_i + 1,
                      )
  
                  if x_i == 0:
                      figure.update_yaxes(
                          title_text=y_param, row=y_i + 1, col=x_i + 1
                      )
                  if y_i == len(params) - 1:
                      figure.update_xaxes(
                          title_text=x_param, row=y_i + 1, col=x_i + 1
                      )
  
      tick_info = _get_tick_info(info.zs)
  
      colormap = "RdYlBu_r"
      colorbar_trace = go.Scatter(
          x=[None],
          y=[None],
          mode="markers",
          marker=dict(
              colorscale=colormap,
              showscale=True,
              cmin=0,
              cmax=1,
              colorbar=dict(
                  thickness=10,
                  tickvals=tick_info.coloridxs,
                  ticktext=tick_info.text,
              ),
          ),
          hoverinfo="none",
          showlegend=False,
      )
      figure.add_trace(colorbar_trace)
      return figure
  
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 8 for calling a global function with example usage: _get_rank_plot(info) and returns: figure, go