code: def test_plot_surf_roi_matplotlib_specific():
      mesh, roi_map, parcellation = _generate_data_test_surf_roi()
      # change vmin, vmax
      img = plot_surf_roi(
          mesh,
          roi_map=roi_map,
          vmin=1.2,
          vmax=8.9,
          colorbar=True,
          engine="matplotlib",
      )
      img.canvas.draw()
      cbar = img.axes[-1]
      cbar_vmin = float(cbar.get_yticklabels()[0].get_text())
      cbar_vmax = float(cbar.get_yticklabels()[-1].get_text())
      assert cbar_vmin == 1.0
      assert cbar_vmax == 8.0
      img2 = plot_surf_roi(
          mesh,
          roi_map=roi_map,
          vmin=1.2,
          vmax=8.9,
          colorbar=True,
          cbar_tick_format="%.2g",
          engine="matplotlib",
      )
      img2.canvas.draw()
      cbar = img2.axes[-1]
      cbar_vmin = float(cbar.get_yticklabels()[0].get_text())
      cbar_vmax = float(cbar.get_yticklabels()[-1].get_text())
      assert cbar_vmin == 1.2
      assert cbar_vmax == 8.9
      # plot to axes
      plot_surf_roi(
          mesh,
          roi_map=roi_map,
          ax=None,
          figure=plt.gcf(),
          engine="matplotlib",
      )
  
      # plot to axes
      with tempfile.NamedTemporaryFile() as tmp_file:
          plot_surf_roi(
              mesh,
              roi_map=roi_map,
              ax=plt.gca(),
              figure=None,
              output_file=tmp_file.name,
              engine="matplotlib",
          )
      with tempfile.NamedTemporaryFile() as tmp_file:
          plot_surf_roi(
              mesh,
              roi_map=roi_map,
              ax=plt.gca(),
              figure=None,
              output_file=tmp_file.name,
              colorbar=True,
              engine="matplotlib",
          )
  
      # Test nans handling
      parcellation[::2] = np.nan
      img = plot_surf_roi(
          mesh, roi_map=parcellation, engine="matplotlib"
      )
      # Check that the resulting plot facecolors contain no transparent faces
      # (last column equals zero) even though the texture contains nan values
      tmp = img._axstack.as_list()[0].collections[0]
      assert mesh[1].shape[0] == ((tmp._facecolors[:, 3]) != 0).sum()
      # Save execution time and memory
      plt.close()
  
imports: import re
  import tempfile
  import unittest.mock
  import matplotlib.pyplot
  import numpy
  import pytest
  from matplotlib.figure import Figure
  from numpy.testing import assert_array_equal
  from nilearn._utils.helpers import is_kaleido_installed, is_plotly_installed
  from nilearn.conftest import _rng
  from nilearn.datasets import fetch_surf_fsaverage
  from nilearn.plotting.displays import PlotlySurfaceFigure
  from nilearn.plotting.surf_plotting import VALID_HEMISPHERES, VALID_VIEWS, _compute_facecolors_matplotlib, _get_ticks_matplotlib, _get_view_plot_surf_matplotlib, _get_view_plot_surf_plotly, plot_img_on_surf, plot_surf, plot_surf_contours, plot_surf_roi, plot_surf_stat_map
  from nilearn.surface import load_surf_data, load_surf_mesh
  from nilearn.surface.tests._testing import generate_surf
label_desc: Use image node_id 27 for calling a global function with example usage: test_plot_surf_roi_matplotlib_specific() without return types