code: def plot_hawkes_kernel_norms(
      kernel_object,
      show=True,
      pcolor_kwargs=None,
      node_names=None,
      rotate_x_labels=0.0,
  ):
      """Generic function to plot Hawkes kernel norms.
  
      Parameters
      ----------
      kernel_object : `Object`
          An object that must have the following API :
  
          * `kernel_object.n_nodes` : a field that stores the number of nodes
            of the associated Hawkes process (thus the number of kernels is
            this number squared)
          * `kernel_object.get_kernel_norms()` : must return a 2d numpy
            array with the norm of each kernel
  
      show : `bool`, default=`True`
          if `True`, show the plot. Otherwise an explicit call to the show
          function is necessary. Useful when superposing several plots.
  
      pcolor_kwargs : `dict`, default=`None`
          Extra pcolor kwargs such as cmap, vmin, vmax
  
      node_names : `list` of `str`, shape=(n_nodes, ), default=`None`
          node names that will be displayed on axis.
          If `None`, node index will be used.
  
      rotate_x_labels : `float`, default=`0.`
          Number of degrees to rotate the x-labels clockwise, to prevent
          overlapping.
  
      Notes
      -----
      Kernels are displayed such that it shows norm of column influence's
      on row.
      """
      n_nodes = kernel_object.n_nodes
  
      if node_names is None:
          node_names = range(n_nodes)
      elif len(node_names) != n_nodes:
          raise ValueError(
              "node_names must be a list of length {} but has length {}".format(
                  n_nodes, len(node_names)
              )
          )
  
      row_labels = ["${} \\rightarrow$".format(i) for i in node_names]
      column_labels = [
          "$\\rightarrow {}$".format(i) for i in node_names
      ]
  
      norms = kernel_object.get_kernel_norms()
      fig, ax = plt.subplots()
  
      if rotate_x_labels != 0.0:
          # we want clockwise rotation because x-axis is on top
          rotate_x_labels = -rotate_x_labels
          x_label_alignment = "right"
      else:
          x_label_alignment = "center"
  
      if pcolor_kwargs is None:
          pcolor_kwargs = {}
  
      if norms.min() >= 0:
          pcolor_kwargs.setdefault("cmap", plt.cm.Blues)
      else:
          # In this case we want a diverging colormap centered on 0
          pcolor_kwargs.setdefault("cmap", plt.cm.RdBu)
          max_abs_norm = np.max(np.abs(norms))
          pcolor_kwargs.setdefault("vmin", -max_abs_norm)
          pcolor_kwargs.setdefault("vmax", max_abs_norm)
  
      heatmap = ax.pcolor(norms, **pcolor_kwargs)
  
      # put the major ticks at the middle of each cell
      ax.set_xticks(np.arange(norms.shape[0]) + 0.5, minor=False)
      ax.set_yticks(np.arange(norms.shape[1]) + 0.5, minor=False)
  
      # want a more natural, table-like display
      ax.invert_yaxis()
      ax.xaxis.tick_top()
  
      ax.set_xticklabels(
          row_labels,
          minor=False,
          fontsize=17,
          rotation=rotate_x_labels,
          ha=x_label_alignment,
      )
      ax.set_yticklabels(column_labels, minor=False, fontsize=17)
  
      fig.subplots_adjust(right=0.8)
      divider = make_axes_locatable(ax)
      cax = divider.append_axes("right", size="5%", pad=0.5)
      fig.colorbar(heatmap, cax=cax)
  
      if show:
          plt.show()
  
      return fig
  
file_path: tick/tick/plot/plot_hawkes.py
imports: import matplotlib.pyplot
  import numpy
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from tick.plot.plot_utilities import share_x, share_y
label_desc: Use image node_id 1 for calling a global function with example usage: plot_hawkes_kernel_norms(kernel_object, show, pcolor_kwargs, node_names, rotate_x_labels) and returns: fig