From 2fe28608d6363e9d8428fa0238903902881fca33 Mon Sep 17 00:00:00 2001 From: Tang Shenli Date: Tue, 27 Feb 2024 16:40:33 +0000 Subject: [PATCH 1/3] fix duplicate axis --- pyqsofit/PyQSOFit.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyqsofit/PyQSOFit.py b/pyqsofit/PyQSOFit.py index 2038d045..1da2eaf9 100644 --- a/pyqsofit/PyQSOFit.py +++ b/pyqsofit/PyQSOFit.py @@ -1980,8 +1980,10 @@ def _pretty_name(plain_name): # Prepare for the emission line subplots in the second row fig, axn = plt.subplots(nrows=2, ncols=np.max([ncomp_fit, 1]), figsize=(15, 8), squeeze=False) + for ax in axn[0]: # turn off the preset axis to leave space to the new subplot + ax.axis('off') ax = plt.subplot(2, 1, 1) # plot the first subplot occupying the whole first row - + self.f_line_narrow_model = np.zeros_like(self.wave) self.f_line_br_model = np.zeros_like(self.wave) lines_total = np.zeros_like(wave_eval) @@ -2252,7 +2254,9 @@ def _pretty_name(plain_name): if self.verbose: print('Saving figure as', os.path.join(save_fig_path, self.sdss_name + '.pdf')) fig.savefig(os.path.join(save_fig_path, self.sdss_name + '.pdf')) - plt.close(fig) # Close figure to save memory + + plt.show() + plt.close(fig) # Close figure to save memory self.fig = fig return From 54d553e7b082a4d257e78d172be24a4d13836a3f Mon Sep 17 00:00:00 2001 From: Tang Shenli Date: Thu, 29 Feb 2024 12:49:37 +0000 Subject: [PATCH 2/3] fix duplicate axis --- pyqsofit/PyQSOFit.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pyqsofit/PyQSOFit.py b/pyqsofit/PyQSOFit.py index 1da2eaf9..eab7f403 100644 --- a/pyqsofit/PyQSOFit.py +++ b/pyqsofit/PyQSOFit.py @@ -1955,7 +1955,7 @@ def _pretty_name(plain_name): format_name = plain_name[:insert_idx] + '\,' + plain_name[insert_idx:] else: format_name = plain_name - return rf'$\mathrm{{{format_name}}}$' + return plain_name #rf'$\mathrm{{{format_name}}}$' pp = list(self.conti_fit.params.valuesdict().values()) @@ -1977,12 +1977,13 @@ def _pretty_name(plain_name): # Number of line complexes actually fitted ncomp_fit = len(self.fur_result) // ( mc_flag * 6) # TODO: Not 5 here. But better not use absolute value to fully fix this bug - + # Prepare for the emission line subplots in the second row fig, axn = plt.subplots(nrows=2, ncols=np.max([ncomp_fit, 1]), figsize=(15, 8), squeeze=False) - for ax in axn[0]: # turn off the preset axis to leave space to the new subplot - ax.axis('off') - ax = plt.subplot(2, 1, 1) # plot the first subplot occupying the whole first row + gs = axn[0, 0].get_gridspec() + for axi in axn[0, :]: + axi.remove() + ax = fig.add_subplot(gs[0, :]) self.f_line_narrow_model = np.zeros_like(self.wave) self.f_line_br_model = np.zeros_like(self.wave) From a43487d850c491ff8cf2f41a9f5e22dc8740c559 Mon Sep 17 00:00:00 2001 From: Tang Shenli Date: Thu, 29 Feb 2024 12:52:22 +0000 Subject: [PATCH 3/3] plain name --- pyqsofit/PyQSOFit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqsofit/PyQSOFit.py b/pyqsofit/PyQSOFit.py index eab7f403..ff3e8fe4 100644 --- a/pyqsofit/PyQSOFit.py +++ b/pyqsofit/PyQSOFit.py @@ -1955,7 +1955,7 @@ def _pretty_name(plain_name): format_name = plain_name[:insert_idx] + '\,' + plain_name[insert_idx:] else: format_name = plain_name - return plain_name #rf'$\mathrm{{{format_name}}}$' + return rf'$\mathrm{{{format_name}}}$' pp = list(self.conti_fit.params.valuesdict().values())