From 2e59d76bdb20cafed6368dad0a4549fbbcb322d9 Mon Sep 17 00:00:00 2001 From: Cas Blaauw <38132585+casblaauw@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:05:54 +0100 Subject: [PATCH 1/2] Update render_plot --- src/crested/pl/_utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/crested/pl/_utils.py b/src/crested/pl/_utils.py index e6c3a137..a2c96f20 100644 --- a/src/crested/pl/_utils.py +++ b/src/crested/pl/_utils.py @@ -90,16 +90,14 @@ def render_plot( label.set_fontsize(y_tick_fontsize) label.set_rotation(y_label_rotation) if tight_rect: - plt.tight_layout(rect=tight_rect) + fig.tight_layout(rect=tight_rect) else: - plt.tight_layout() + fig.tight_layout() if save_path: plt.savefig(save_path) if show: - plt.show() - else: - plt.close(fig) + fig.show() if not show and not save_path: return fig From ad84e2db5599c4375c42dbb420fe48ef6e8a8ac1 Mon Sep 17 00:00:00 2001 From: Cas Blaauw <38132585+casblaauw@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:25:49 +0100 Subject: [PATCH 2/2] Keep show as plt.show() --- src/crested/pl/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crested/pl/_utils.py b/src/crested/pl/_utils.py index a2c96f20..cd771755 100644 --- a/src/crested/pl/_utils.py +++ b/src/crested/pl/_utils.py @@ -97,7 +97,7 @@ def render_plot( plt.savefig(save_path) if show: - fig.show() + plt.show() if not show and not save_path: return fig