Skip to content

Commit

Permalink
issue #383 provide supporting plotting multiple plot types with singl…
Browse files Browse the repository at this point in the history
…e config file
  • Loading branch information
bikegeek committed Feb 19, 2024
1 parent 9001eb9 commit 992df46
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions metplotpy/plots/tcmpr_plots/box/tcmpr_box.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' \
Expand Down

0 comments on commit 992df46

Please sign in to comment.