From 7d108afe223d97810c1941ad21aeb28ad8b5396e Mon Sep 17 00:00:00 2001 From: cyschneck <22159116+cyschneck@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:56:26 -0600 Subject: [PATCH] prevent plt.show() triggering when show_plot=False --- centerline_width/plotDiagrams.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/centerline_width/plotDiagrams.py b/centerline_width/plotDiagrams.py index a933820..9f0adac 100644 --- a/centerline_width/plotDiagrams.py +++ b/centerline_width/plotDiagrams.py @@ -244,6 +244,7 @@ def plotCenterline(river_object: centerline_width.riverCenterline = None, plt.legend(loc="upper right") if show_plot: plt.show() + if not show_plot: plt.close() if save_plot_name: fig.savefig(save_plot_name) @@ -391,4 +392,5 @@ def plotCenterlineWidth(river_object: centerline_width.riverCenterline = None, plt.legend(loc="upper right") if show_plot: plt.show() + if not show_plot: plt.close() if save_plot_name: fig.savefig(save_plot_name)