From 723d70b3adf92a050223094c92d6e61824a9fcb9 Mon Sep 17 00:00:00 2001 From: Shintaro Sakoda Date: Tue, 22 Oct 2024 10:46:04 +0900 Subject: [PATCH] Added "skip_plt_show" arg to plotter Signed-off-by: Shintaro Sakoda --- .../system_performance_plotter_base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/autoware_debug_tools/autoware_debug_tools/system_performance_plotter/system_performance_plotter_base.py b/common/autoware_debug_tools/autoware_debug_tools/system_performance_plotter/system_performance_plotter_base.py index 458c2d6a..6da5988a 100644 --- a/common/autoware_debug_tools/autoware_debug_tools/system_performance_plotter/system_performance_plotter_base.py +++ b/common/autoware_debug_tools/autoware_debug_tools/system_performance_plotter/system_performance_plotter_base.py @@ -36,6 +36,7 @@ def __init__(self, args, ylabel, output_suffix): self.ymax = args.ymax self.number_of_plot = args.number_of_plot self.save_result = args.save_result + self.skip_plt_show = args.skip_plt_show self.ylabel = ylabel self.output_suffix = output_suffix @@ -174,7 +175,8 @@ def run(self): # save figure of plot plt.savefig(f"./result/{output_name}-{timestamp}.png") - plt.show() + if not self.skip_plt_show: + plt.show() def create_common_argment(ymax=None): @@ -193,6 +195,9 @@ def create_common_argment(ymax=None): parser.add_argument( "-s", "--save-result", default=False, action="store_true", help="whether to save result" ) + parser.add_argument( + "-p", "--skip_plt_show", default=False, action="store_true", help="whether to skip plt.show()" + ) args = parser.parse_args()