class_docstr: Granger causality matrix.
code: def _plot(self) -> plt.figure:
      nvars = len(self.dfp)
      figsize = max(
          self.min_figsize,
          (self.figsize[0] * nvars, self.figsize[1] * nvars),
      )
      fig = plt.figure(figsize=figsize)
      layout = (nvars, nvars)
  
      norm_reject = mpl.colors.Normalize(
          vmin=self.critical, vmax=1, clip=True
      )
      norm_accept = mpl.colors.Normalize(
          vmin=0, vmax=self.critical, clip=True
      )
      mapper_reject = mpl.cm.ScalarMappable(
          norm=norm_reject, cmap="Greys"
      )
      mapper_accept = mpl.cm.ScalarMappable(
          norm=norm_accept, cmap="PuBu_r"
      )
  
      for i, a in enumerate(self.dfp.index):
          for j, b in enumerate(self.dfp.columns):
              ax = plt.subplot2grid(layout, (i, j))
  
              if i == nvars - 1:
                  label = self.shorten(b[:-3]) + b[-3:]
                  ax.set_xlabel(
                      label,
                      rotation=30,
                      ha="right",
                      rotation_mode="anchor",
                  )
                  ax.tick_params(
                      axis="x",
                      which="both",
                      labelbottom=False,
                      bottom=False,
                  )
              else:
                  ax.xaxis.set_visible(False)
  
              if j == 0:
                  label = self.shorten(a[:-3]) + a[-3:]
                  ax.set_ylabel(
                      label,
                      rotation=30,
                      ha="right",
                      rotation_mode="anchor",
                  )
                  ax.tick_params(
                      axis="y",
                      which="both",
                      labelleft=False,
                      left=False,
                  )
              else:
                  ax.yaxis.set_visible(False)
  
              if i == j:
                  ax.set_facecolor("black")
                  continue
  
              pval = self.dfp.loc[a, b]
              lag = self.dfl.loc[a, b]
              if pval < self.critical:
                  color = mapper_accept.to_rgba(pval)
                  acolor = (
                      "black"
                      if pval > (self.critical / 2.0)
                      else "white"
                  )
              else:
                  color = mapper_reject.to_rgba(pval)
                  acolor = (
                      "#aaaaaa"
                      if pval
                      > ((1 - self.critical) / 2.0 + self.critical)
                      else "#888888"
                  )
              ax.set_facecolor(color)
              ax.text(
                  0.5,
                  0.6,
                  f"{pval:.5f}",
                  color=acolor,
                  fontsize=9,
                  transform=ax.transAxes,
                  horizontalalignment="center",
                  verticalalignment="center",
              )
              ax.text(
                  0.5,
                  0.25,
                  f"lag: {lag:d}",
                  color=acolor,
                  fontsize=7,
                  transform=ax.transAxes,
                  horizontalalignment="center",
                  verticalalignment="center",
              )
  
      with warnings.catch_warnings():
          warnings.filterwarnings("ignore", category=UserWarning)
          plt.tight_layout()
      fig.subplots_adjust(wspace=0, hspace=0)
      plt.close(fig)
      return fig
  
file_path: tslumen/tslumen/plot/static/misc.py
imports: from typing import Tuple, Callable
  import warnings
  from dataclasses import dataclass
  import pandas
  import networkx
  import matplotlib
  import matplotlib.pyplot
  from tslumen.plot.static.base import Figure
label_desc: Use image node_id 1 for calling the GrangerMatrix obj's underlying member method code with example usage: obj._plot() and returns: fig