docs: def plot_recurrence_model(
          input_model, catalogue, completeness, dmag=0.1, filename=None,
          figure_size=(8, 6), filetype='png', dpi=300, ax=None):
      """
      Plot a calculated recurrence model over an observed catalogue, adjusted for
      time-varying completeness
      """
      annual_rates, cumulative_rates = _get_recurrence_model(input_model)
  
      # Get observed annual recurrence
      if not catalogue.end_year:
          catalogue.update_end_year()
      cent_mag, t_per, n_obs = get_completeness_counts(catalogue,
                                                       completeness,
                                                       dmag)
      obs_rates = n_obs / t_per
      cum_obs_rates = np.array([np.sum(obs_rates[i:])
                                for i in range(len(obs_rates))])
  
      if ax is None:
          fig, ax = plt.subplots(figsize=figure_size)
      else:
          fig = ax.get_figure()
  
      ax.semilogy(cent_mag, obs_rates, 'bo')
      ax.semilogy(annual_rates[:, 0], annual_rates[:, 1], 'b-')
      ax.semilogy(cent_mag, cum_obs_rates, 'rs')
      ax.semilogy(annual_rates[:, 0], cumulative_rates, 'r-')
      ax.grid(which='both')
      ax.set_xlabel('Magnitude')
      ax.set_ylabel('Annual Rate')
      ax.legend(['Observed Incremental Rate',
                 'Model Incremental Rate',
                 'Observed Cumulative Rate',
                 'Model Cumulative Rate'])
      ax.tick_params(labelsize=12)
      _save_image(fig, filename, filetype, dpi)