code: def _debug_plots(
      self, X, eigs, info, matrix_name, lobpcg_debug_plot_dir
  ):
      # We import matplotlib lazily because (a) it's faster this way, and
      # (b) concurrent imports of matplotlib appear to trigger some sort of
      # collision on the matplotlib cache lock on Windows.
      from matplotlib import pyplot as plt
  
      os.makedirs(lobpcg_debug_plot_dir, exist_ok=True)
      clean_matrix_name = _clean_matrix_name(matrix_name)
      n, k = X.shape
      dt = "f32" if X.dtype == np.float32 else "f64"
      figpath = os.path.join(
          lobpcg_debug_plot_dir,
          f"{clean_matrix_name}_n{n}_k{k}_{dt}.png",
      )
  
      plt.switch_backend("Agg")
  
      fig, (ax0, ax1, ax2, ax3) = plt.subplots(1, 4, figsize=(24, 4))
      fig.suptitle(rf"{matrix_name} ${n=},{k=}$, {dt}")
      line_styles = [":", "--", "-.", "-"]
  
      for key, ls in zip(["X orth", "P orth", "P.X"], line_styles):
          ax0.semilogy(info[key], ls=ls, label=key)
      ax0.set_title("basis average orthogonality")
      ax0.legend()
  
      relerrs = np.abs(np.array(info["lambda history"]) - eigs) / eigs
      keys = ["max", "p50", "min"]
      fns = [np.max, np.median, np.min]
      for key, fn, ls in zip(keys, fns, line_styles):
          ax1.semilogy(fn(relerrs, axis=1), ls=ls, label=key)
      ax1.set_title("eigval relerr")
      ax1.legend()
  
      for key, ls in zip(
          ["basis rank", "converged", "P zeros"], line_styles
      ):
          ax2.plot(info[key], ls=ls, label=key)
      ax2.set_title("basis dimension counts")
      ax2.legend()
  
      prefix = "adjusted residual"
      for key, ls in zip(keys, line_styles):
          ax3.semilogy(info[prefix + " " + key], ls=ls, label=key)
      ax3.axhline(np.finfo(X.dtype).eps, label="eps", c="k")
      ax3.legend()
      ax3.set_title(prefix + rf" $\lambda_{{\max}}=\ ${eigs[0]:.1e}")
  
      fig.savefig(figpath, bbox_inches="tight")
      plt.close(fig)
  
imports: import functools
  import re
  import os
  import unittest
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import scipy.linalg
  import scipy.sparse
  import jax
  from jax import config
  from jax._src import test_util
  from jax.experimental.sparse import linalg, bcoo
  import jax.numpy
label_desc: Use image node_id 4 for calling the LobpcgTest obj's underlying member method code with example usage: obj._debug_plots(X, eigs, info, matrix_name, lobpcg_debug_plot_dir) without return types