code: def qq_plots(
      point_process: Optional[SimuPointProcess] = None,
      residuals: Optional[List[np.ndarray]] = None,
      plot_nodes=None,
      node_names=None,
      line="45",
      show=True,
      ax=None,
  ):
      import statsmodels.api as sm
      from scipy.stats import expon
  
      if residuals is None:
          assert (
              point_process is not None
          ), "You must pass an object of class `SimuPointProcess` or a list of np.ndarray of residuals"
      else:
          assert (
              point_process is None
          ), "You must pass either an object of class `SimuPointProcess` or residuals, not both"
  
      if plot_nodes is None:
          if point_process is not None:
              plot_nodes = range(point_process.n_nodes)
          elif residuals is not None:
              plot_nodes = range(len(residuals))
          else:
              raise ValueError("Could not infer which nodes to plot")
  
      if node_names is None:
          node_names = list(
              map(lambda n: "ticks #{}".format(n), plot_nodes)
          )
      elif len(node_names) != len(plot_nodes):
          raise ValueError(
              "node_names must be a list of length {} but has length {}".format(
                  len(plot_nodes), len(node_names)
              )
          )
      labels = node_names
  
      if ax is None:
          fig, ax = plt.subplots(
              len(plot_nodes),
              1,
              sharex=True,
              sharey=True,
              figsize=(12, 4 * len(plot_nodes)),
          )
      else:
          show = False
  
      if len(plot_nodes) == 1:
          ax = [ax]
  
      if residuals is None:
          compensators = point_process.tracked_compensator
          if compensators is None:
              raise ValueError("No tracked compensator!")
          residuals = [np.diff(comp) for comp in compensators]
  
      for count, i in enumerate(plot_nodes):
          sm.qqplot(
              data=residuals[i],
              dist=expon,
              distargs=(),
              loc=0,
              scale=1,
              line=line,
              ax=ax[count],
          )
          ax[count].set_title(labels[count])
      if show:
          plt.show()
      return ax[0].figure
  
file_path: tick/tick/plot/plot_point_processes.py
imports: import matplotlib.pyplot
  import numpy
  from typing import Optional, List
  from tick.hawkes.simulation.base import SimuPointProcess
label_desc: Use image node_id 5 for calling a global function with example usage: qq_plots(point_process, residuals, plot_nodes, node_names, line, show, ax) and returns: ax