From 7eb78cf9ed7efd29d45843c72586e58907a7c551 Mon Sep 17 00:00:00 2001 From: SakodaShintaro Date: Tue, 22 Oct 2024 14:23:03 +0900 Subject: [PATCH] feat: add "skip_plt_show" arg to plotter (#136) * Added "skip_plt_show" arg to plotter Signed-off-by: Shintaro Sakoda * style(pre-commit): autofix --------- Signed-off-by: Shintaro Sakoda Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../system_performance_plotter_base.py | 11 ++++++++++- 1 file changed, 10 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..76e73360 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,13 @@ 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()