From e4fb66d9cbb79a137b9bab26186a45eafd3482aa Mon Sep 17 00:00:00 2001 From: Poultfloyd Date: Tue, 3 Oct 2023 13:44:45 +0200 Subject: [PATCH] Update nested_res_V4p3.py Modify the triangle_plot method to allow saving figures and choosing a subset of the parameters --- nested_res_V4p3.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/nested_res_V4p3.py b/nested_res_V4p3.py index 79a0a8d..ed1368d 100644 --- a/nested_res_V4p3.py +++ b/nested_res_V4p3.py @@ -1471,19 +1471,28 @@ def histo2D_interp(self,par_name1,par_name2,path=currentpath): #--------------------------------------------------------------------------------------------------------------------- - def triangle_plot(self,path=currentpath): - ''' + def triangle_plot( + self, path: str = currentpath, params: list = None, savefile: bool = False + ) -> None: + """ Triangle plot of all probability distributions using GetDist package - ''' + + + Args: + path (str, optional): Path to the output files. Defaults to the current path. + params (list, optional): List of str with the name of the parameters. Defaults to None for all parameters. + savefile (bool, optional): Option for saving the triangle plot. Saved under currentpath/triangle_plot.pdf. Defaults to False. + """ + from getdist import plots self.path = path - g = plots.get_subplot_plotter() - g.triangle_plot(self.path+'/nf_output_points',filled=True) + g.triangle_plot(self.path + "/nf_output_points", params=params, filled=True) + if savefile == True: + plt.savefig(self.path + "/triangle_plot.pdf") plt.tight_layout() - plt.show()