diff --git a/cosmosis/postprocessing/plots.py b/cosmosis/postprocessing/plots.py index 074a79ea..4023372e 100644 --- a/cosmosis/postprocessing/plots.py +++ b/cosmosis/postprocessing/plots.py @@ -1080,8 +1080,11 @@ def plot_1d(self, name, mu, sigma): sigma2 = sigma**2 x = np.linspace(xmin, xmax, 200) p = np.exp(-0.5 * (x-mu)**2 / sigma2)# / np.sqrt(2*np.pi*sigma2) - figure,filename = self.figure(name) + figure, filename = self.figure(name) pylab.figure(figure.number) + if not hasattr(figure, "cosmosis_done_truth"): + self.plot_truth_1d(name) + figure.cosmosis_done_truth = True pylab.plot(x, p, label=self.source.label) pylab.xlabel(self.latex(name)) pylab.ylabel("Posterior") @@ -1116,9 +1119,13 @@ def plot_2d(self, name1, i, name2, j): s22 = covmat[1,1]**0.5 #Open the figure (new or existing) for this pair - figure,filename = self.figure("2D", name1, name2) + figure, filename = self.figure("2D", name1, name2) pylab.figure(figure.number) + if not hasattr(figure, "cosmosis_done_truth"): + self.plot_truth_2d(name1, name2) + figure.cosmosis_done_truth = True + #Plot the 1 sigma and 2 sigma ellipses self.plot_cov_ellipse(covmat, pos, nstd=1, facecolor=None, edgecolor=self.line_color(), linewidth=2, fill=False, label=self.source.label) @@ -1363,4 +1370,4 @@ def run(self): pylab.xlabel(self.latex(col1)) pylab.ylabel(self.latex(col2)) filenames.append(filename) - return filenames \ No newline at end of file + return filenames