docs: def plot_gridlines(ax=None, c="grey", lw=1, diagonal=False, zorder=2, makegrid=True):
      """Plot dotted gridlines onto an axis.
  
      Parameters
      ----------
      ax : matplotlib AxesSubplot object (optional)
          Axis to add gridlines to. If None, uses current axis. Default is None.
      c : matplotlib color argument (optional)
          Gridline color. Default is grey.
      lw : number (optional)
          Gridline linewidth. Default is 1.
      diagonal : boolean (optional)
          Toggle inclusion of diagonal gridline. Default is False.
      zorder : number (optional)
          zorder of plotted grid. Default is 2.
      """
      # get ax
      if ax is None:
          ax = plt.gca()
      ax.grid()
      # get dashes
      ls = ":"
      dashes = (lw / 2, lw)
      # grid
      # ax.grid(True)
      lines = ax.xaxis.get_gridlines() + ax.yaxis.get_gridlines()
      for line in lines.copy():
          line.set_linestyle(":")
          line.set_color(c)
          line.set_linewidth(lw)
          line.set_zorder(zorder)
          line.set_dashes(dashes)
          ax.add_line(line)
      # diagonal
      if diagonal:
          min_xi, max_xi = ax.get_xlim()
          min_yi, max_yi = ax.get_ylim()
          diag_min = max(min_xi, min_yi)
          diag_max = min(max_xi, max_yi)
          ax.plot(
              [diag_min, diag_max],
              [diag_min, diag_max],
              c=c,
              ls=ls,
              lw=lw,
              zorder=zorder,
              dashes=dashes,
          )
  
          # Plot resets xlim and ylim sometimes for unknown reasons.
          # This is here to ensure that the xlim and ylim are unchanged
          # after adding a diagonal, whose limits are calculated so
          # as to not change the xlim and ylim.
          #           -- KFS 2017-09-26
          ax.set_ylim(min_yi, max_yi)
          ax.set_xlim(min_xi, max_xi)