<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plot_sediment_memory(self, ax=None):
 """Plot sediment memory prior and posterior distributions"""

        if ax is None:
            ax = plt.gca()

        y_prior, x_prior = self.prior_sediment_memory()
        ax.plot(x_prior, y_prior, label='Prior')

        y_posterior = self.mcmcfit.sediment_memory
        density = scipy.stats.gaussian_kde(y_posterior ** (1/self.thick))
        density.covariance_factor = lambda: 0.25
        density._compute_covariance()
        ax.plot(x_prior, density(x_prior), label='Posterior')

        mem_mean = self.mcmcsetup.mcmc_kws['mem_mean']
        mem_strength = self.mcmcsetup.mcmc_kws['mem_strength']
        annotstr_template = 'mem_strength: {0}\nmem_mean: {1}\nthick: {2} cm'
        annotstr = annotstr_template.format(mem_strength, mem_mean, self.thick)
        ax.annotate(annotstr, xy=(0.9, 0.9), xycoords='axes fraction',
                    horizontalalignment='right', verticalalignment='top')

        ax.set_ylabel('Density')
        ax.set_xlabel('Memory (ratio)')
        ax.grid(True)
        return ax