code: def test_color_map(direction: str) -> None:
      study = create_study(direction=direction)
      for i in range(3):
          study.add_trial(
              create_trial(
                  value=float(i),
                  params={"param_a": float(i), "param_b": float(i)},
                  distributions={
                      "param_a": FloatDistribution(0.0, 3.0),
                      "param_b": FloatDistribution(0.0, 3.0),
                  },
              )
          )
  
      # `target` is `None`.
      contour = plotly_plot_contour(study).data[0]
      assert COLOR_SCALE == [v[1] for v in contour["colorscale"]]
      if direction == "minimize":
          assert contour["reversescale"]
      else:
          assert not contour["reversescale"]
  
      # When `target` is not `None`, `reversescale` is always `True`.
      contour = plotly_plot_contour(
          study, target=lambda t: t.number, target_name="Number"
      ).data[0]
      assert COLOR_SCALE == [v[1] for v in contour["colorscale"]]
      assert contour["reversescale"]
  
      # Multi-objective optimization.
      study = create_study(directions=[direction, direction])
      for i in range(3):
          study.add_trial(
              create_trial(
                  values=[float(i), float(i)],
                  params={"param_a": float(i), "param_b": float(i)},
                  distributions={
                      "param_a": FloatDistribution(0.0, 3.0),
                      "param_b": FloatDistribution(0.0, 3.0),
                  },
              )
          )
      contour = plotly_plot_contour(
          study, target=lambda t: t.number, target_name="Number"
      ).data[0]
      assert COLOR_SCALE == [v[1] for v in contour["colorscale"]]
      assert contour["reversescale"]
  
imports: from __future__ import annotations
  from io import BytesIO
  import math
  from typing import Any
  from typing import Callable
  import numpy
  import pytest
  from optuna.distributions import BaseDistribution
  from optuna.distributions import CategoricalDistribution
  from optuna.distributions import FloatDistribution
  from optuna.study import create_study
  from optuna.study import Study
  from optuna.testing.objectives import fail_objective
  from optuna.testing.visualization import prepare_study_with_trials
  from optuna.trial import create_trial
  from optuna.visualization import plot_contour
  from optuna.visualization._contour import _AxisInfo
  from optuna.visualization._contour import _ContourInfo
  from optuna.visualization._contour import _get_contour_info
  from optuna.visualization._contour import _SubContourInfo
  from optuna.visualization._plotly_imports import go
  from optuna.visualization._utils import COLOR_SCALE
  from optuna.visualization.matplotlib import plot_contour
  from optuna.visualization.matplotlib._matplotlib_imports import Axes
  from optuna.visualization.matplotlib._matplotlib_imports import plt
label_desc: Use image node_id 22 for calling a global function with example usage: test_color_map(direction) without return types