From 992df4633be16a92b634ba22905fc56909555c60 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Mon, 19 Feb 2024 13:17:39 -0700 Subject: [PATCH] issue #383 provide supporting plotting multiple plot types with single config file --- metplotpy/plots/tcmpr_plots/box/tcmpr_box.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) mode change 100644 => 100755 metplotpy/plots/tcmpr_plots/box/tcmpr_box.py diff --git a/metplotpy/plots/tcmpr_plots/box/tcmpr_box.py b/metplotpy/plots/tcmpr_plots/box/tcmpr_box.py old mode 100644 new mode 100755 index 847c6349..24e223d2 --- a/metplotpy/plots/tcmpr_plots/box/tcmpr_box.py +++ b/metplotpy/plots/tcmpr_plots/box/tcmpr_box.py @@ -7,31 +7,33 @@ class TcmprBox(TcmprBoxPoint): - def __init__(self, config_obj, column_info, col, case_data, input_df, baseline_data): - super().__init__(config_obj, column_info, col, case_data, input_df, baseline_data) + def __init__(self, config_obj, column_info, col, case_data, input_df, baseline_data, stat_name): + super().__init__(config_obj, column_info, col, case_data, input_df, baseline_data, stat_name) print("--------------------------------------------------------") print(f"Plotting BOXPLOT time series by {self.config_obj.series_val_names[0]}") - self._adjust_titles() - self.series_list = self._create_series(self.input_df) + self._adjust_titles(stat_name) + self.series_list = self._create_series(self.input_df, stat_name) self.case_data = None self.cur_baseline = baseline_data['cur_baseline'] self.cur_baseline_data = baseline_data['cur_baseline_data'] self._init_hfip_baseline_for_plot() if self.config_obj.prefix is None or len(self.config_obj.prefix) == 0: - self.plot_filename = f"{self.config_obj.plot_dir}{os.path.sep}{self.config_obj.list_stat_1[0]}_boxplot.png" + self.plot_filename = f"{self.config_obj.plot_dir}{os.path.sep}{stat_name}_boxplot.png" else: - self.plot_filename = f"{self.config_obj.plot_dir}{os.path.sep}{self.config_obj.prefix}.png" + self.plot_filename = f"{self.config_obj.plot_dir}{os.path.sep}{self.config_obj.prefix}_{stat_name}_boxplot.png" - # remove the old file if it exist + # remove the old file if it exists if os.path.exists(self.plot_filename): os.remove(self.plot_filename) self._create_figure() - def _adjust_titles(self): + def _adjust_titles(self, stat_name): if self.yaxis_1 is None or len(self.yaxis_1) == 0: - self.yaxis_1 = self.config_obj.list_stat_1[0] + '(' + self.col['units'] + ')' + # ToDo Remove when done DEBUGGING + # self.yaxis_1 = self.config_obj.list_stat_1[0] + '(' + self.col['units'] + ')' + self.yaxis_1 = stat_name + '(' + self.col['units'] + ')' if self.title is None or len(self.title) == 0: self.title = 'Boxplots of ' + self.col['desc'] + ' by ' \