code: def plot_slice(
      study: Study,
      params: list[str] | None = None,
      *,
      target: Callable[[FrozenTrial], float] | None = None,
      target_name: str = "Objective Value",
  ) -> "Axes":
      """Plot the parameter relationship as slice plot in a study with Matplotlib.
  
      .. seealso::
          Please refer to :func:`optuna.visualization.plot_slice` for an example.
  
      Example:
  
          The following code snippet shows how to plot the parameter relationship as slice plot.
  
          .. plot::
  
              import optuna
  
  
              def objective(trial):
                  x = trial.suggest_float("x", -100, 100)
                  y = trial.suggest_categorical("y", [-1, 0, 1])
                  return x ** 2 + y
  
  
              sampler = optuna.samplers.TPESampler(seed=10)
              study = optuna.create_study(sampler=sampler)
              study.optimize(objective, n_trials=10)
  
              optuna.visualization.matplotlib.plot_slice(study, params=["x", "y"])
  
      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 axis label.
  
  
      Returns:
          A :class:`matplotlib.axes.Axes` object.
      """
  
      _imports.check()
      return _get_slice_plot(
          _get_slice_plot_info(study, params, target, target_name)
      )
  
file_path: optuna/optuna/visualization/matplotlib/_slice.py
imports: from __future__ import annotations
  from collections import defaultdict
  import math
  from typing import Any
  from typing import Callable
  from optuna._experimental import experimental_func
  from optuna.study import Study
  from optuna.trial import FrozenTrial
  from optuna.visualization._slice import _get_slice_plot_info
  from optuna.visualization._slice import _PlotValues
  from optuna.visualization._slice import _SlicePlotInfo
  from optuna.visualization._slice import _SliceSubplotInfo
  from optuna.visualization.matplotlib._matplotlib_imports import _imports
label_desc: Use image node_id 1 for calling a global function with example usage: plot_slice(study, params) and returns: _get_slice_plot