code: def test_plot_importance(params, breast_cancer_split, train_data):
      X_train, _, y_train, _ = breast_cancer_split
  
      gbm0 = lgb.train(params, train_data, num_boost_round=10)
      ax0 = lgb.plot_importance(gbm0)
      assert isinstance(ax0, matplotlib.axes.Axes)
      assert ax0.get_title() == "Feature importance"
      assert ax0.get_xlabel() == "Feature importance"
      assert ax0.get_ylabel() == "Features"
      assert len(ax0.patches) <= 30
  
      gbm1 = lgb.LGBMClassifier(
          n_estimators=10, num_leaves=3, verbose=-1
      )
      gbm1.fit(X_train, y_train)
  
      ax1 = lgb.plot_importance(
          gbm1, color="r", title="t", xlabel="x", ylabel="y"
      )
      assert isinstance(ax1, matplotlib.axes.Axes)
      assert ax1.get_title() == "t"
      assert ax1.get_xlabel() == "x"
      assert ax1.get_ylabel() == "y"
      assert len(ax1.patches) <= 30
      for patch in ax1.patches:
          assert patch.get_facecolor() == (1.0, 0, 0, 1.0)  # red
  
      ax2 = lgb.plot_importance(
          gbm0,
          color=["r", "y", "g", "b"],
          title=None,
          xlabel=None,
          ylabel=None,
      )
      assert isinstance(ax2, matplotlib.axes.Axes)
      assert ax2.get_title() == ""
      assert ax2.get_xlabel() == ""
      assert ax2.get_ylabel() == ""
      assert len(ax2.patches) <= 30
      assert ax2.patches[0].get_facecolor() == (1.0, 0, 0, 1.0)  # r
      assert ax2.patches[1].get_facecolor() == (0.75, 0.75, 0, 1.0)  # y
      assert ax2.patches[2].get_facecolor() == (0, 0.5, 0, 1.0)  # g
      assert ax2.patches[3].get_facecolor() == (0, 0, 1.0, 1.0)  # b
  
      ax3 = lgb.plot_importance(
          gbm0,
          title="t @importance_type@",
          xlabel="x @importance_type@",
          ylabel="y @importance_type@",
      )
      assert isinstance(ax3, matplotlib.axes.Axes)
      assert ax3.get_title() == "t @importance_type@"
      assert ax3.get_xlabel() == "x split"
      assert ax3.get_ylabel() == "y @importance_type@"
      assert len(ax3.patches) <= 30
  
      gbm2 = lgb.LGBMClassifier(
          n_estimators=10,
          num_leaves=3,
          verbose=-1,
          importance_type="gain",
      )
      gbm2.fit(X_train, y_train)
  
      def get_bounds_of_first_patch(axes):
          return axes.patches[0].get_extents().bounds
  
      first_bar1 = get_bounds_of_first_patch(lgb.plot_importance(gbm1))
      first_bar2 = get_bounds_of_first_patch(
          lgb.plot_importance(gbm1, importance_type="split")
      )
      first_bar3 = get_bounds_of_first_patch(
          lgb.plot_importance(gbm1, importance_type="gain")
      )
      first_bar4 = get_bounds_of_first_patch(lgb.plot_importance(gbm2))
      first_bar5 = get_bounds_of_first_patch(
          lgb.plot_importance(gbm2, importance_type="split")
      )
      first_bar6 = get_bounds_of_first_patch(
          lgb.plot_importance(gbm2, importance_type="gain")
      )
  
      assert first_bar1 == first_bar2
      assert first_bar1 == first_bar5
      assert first_bar3 == first_bar4
      assert first_bar3 == first_bar6
      assert first_bar1 != first_bar3
  
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 5 for calling a global function with example usage: test_plot_importance(params, breast_cancer_split, train_data) and returns: axes