code: def test_plot_metrics(params, breast_cancer_split, train_data):
      X_train, X_test, y_train, y_test = breast_cancer_split
      test_data = lgb.Dataset(X_test, y_test, reference=train_data)
      params.update({"metric": {"binary_logloss", "binary_error"}})
  
      evals_result0 = {}
      lgb.train(
          params,
          train_data,
          valid_sets=[train_data, test_data],
          valid_names=["v1", "v2"],
          num_boost_round=10,
          callbacks=[lgb.record_evaluation(evals_result0)],
      )
      with pytest.warns(
          UserWarning,
          match="More than one metric available, picking one to plot.",
      ):
          ax0 = lgb.plot_metric(evals_result0)
      assert isinstance(ax0, matplotlib.axes.Axes)
      assert ax0.get_title() == "Metric during training"
      assert ax0.get_xlabel() == "Iterations"
      assert ax0.get_ylabel() in {"binary_logloss", "binary_error"}
      legend_items = ax0.get_legend().get_texts()
      assert len(legend_items) == 2
      assert legend_items[0].get_text() == "v1"
      assert legend_items[1].get_text() == "v2"
  
      ax1 = lgb.plot_metric(evals_result0, metric="binary_error")
      assert isinstance(ax1, matplotlib.axes.Axes)
      assert ax1.get_title() == "Metric during training"
      assert ax1.get_xlabel() == "Iterations"
      assert ax1.get_ylabel() == "binary_error"
      legend_items = ax1.get_legend().get_texts()
      assert len(legend_items) == 2
      assert legend_items[0].get_text() == "v1"
      assert legend_items[1].get_text() == "v2"
  
      ax2 = lgb.plot_metric(
          evals_result0, metric="binary_logloss", dataset_names=["v2"]
      )
      assert isinstance(ax2, matplotlib.axes.Axes)
      assert ax2.get_title() == "Metric during training"
      assert ax2.get_xlabel() == "Iterations"
      assert ax2.get_ylabel() == "binary_logloss"
      legend_items = ax2.get_legend().get_texts()
      assert len(legend_items) == 1
      assert legend_items[0].get_text() == "v2"
  
      ax3 = lgb.plot_metric(
          evals_result0,
          metric="binary_logloss",
          dataset_names=["v1"],
          title="Metric @metric@",
          xlabel="Iterations @metric@",
          ylabel='Value of "@metric@"',
          figsize=(5, 5),
          dpi=600,
          grid=False,
      )
      assert isinstance(ax3, matplotlib.axes.Axes)
      assert ax3.get_title() == "Metric @metric@"
      assert ax3.get_xlabel() == "Iterations @metric@"
      assert ax3.get_ylabel() == 'Value of "binary_logloss"'
      legend_items = ax3.get_legend().get_texts()
      assert len(legend_items) == 1
      assert legend_items[0].get_text() == "v1"
      assert ax3.get_figure().get_figheight() == 5
      assert ax3.get_figure().get_figwidth() == 5
      assert ax3.get_figure().get_dpi() == 600
      for grid_line in ax3.get_xgridlines():
          assert not grid_line.get_visible()
      for grid_line in ax3.get_ygridlines():
          assert not grid_line.get_visible()
  
      evals_result1 = {}
      lgb.train(
          params,
          train_data,
          num_boost_round=10,
          callbacks=[lgb.record_evaluation(evals_result1)],
      )
      with pytest.raises(
          ValueError, match="eval results cannot be empty."
      ):
          lgb.plot_metric(evals_result1)
  
      gbm2 = lgb.LGBMClassifier(
          n_estimators=10, num_leaves=3, verbose=-1
      )
      gbm2.fit(X_train, y_train, eval_set=[(X_test, y_test)])
      ax4 = lgb.plot_metric(gbm2, title=None, xlabel=None, ylabel=None)
      assert isinstance(ax4, matplotlib.axes.Axes)
      assert ax4.get_title() == ""
      assert ax4.get_xlabel() == ""
      assert ax4.get_ylabel() == ""
      legend_items = ax4.get_legend().get_texts()
      assert len(legend_items) == 1
      assert legend_items[0].get_text() == "valid_0"
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.model_selection import train_test_split
  import lightgbm
  from lightgbm.compat import GRAPHVIZ_INSTALLED, MATPLOTLIB_INSTALLED, PANDAS_INSTALLED, pd_DataFrame
  from .utils import load_breast_cancer, make_synthetic_regression
label_desc: Use image node_id 14 for calling a global function with example usage: test_plot_metrics(params, breast_cancer_split, train_data) without return types