code: def test_plot_noncurrent_axes(affine_eye, rng):
      """Regression test for Issue #450."""
      maps_img = Nifti1Image(rng.random((10, 10, 10)), np.eye(4))
      fh1 = plt.figure()
      fh2 = plt.figure()
      ax1 = fh1.add_subplot(1, 1, 1)
  
      assert plt.gcf() == fh2, "fh2  was the last plot created."
  
      # Since we gave ax1, the figure should be plotted in fh1.
      # Before #451, it was plotted in fh2.
      slicer = plot_glass_brain(maps_img, axes=ax1, title="test")
      for ax_name, niax in slicer.axes.items():
          ax_fh = niax.ax.get_figure()
          assert ax_fh == fh1, f"New axis {ax_name} should be in fh1."
      plt.close()
  
file_path: nilearn/nilearn/plotting/tests/test_img_plotting/test_plot_glass_brain.py
imports: import matplotlib.pyplot
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from nilearn.image import get_data
  from nilearn.plotting import plot_glass_brain
label_desc: Use image node_id 3 for calling a global function with example usage: test_plot_noncurrent_axes(affine_eye, rng) without return types