From d240de3c4da79d41bcdf81776da61429318bb4b0 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Tue, 16 May 2023 13:44:28 -0600 Subject: [PATCH] allow adjust sample_no texts position --- sohstationviewer/view/plotting/plotting_widget/plotting.py | 4 +++- .../view/plotting/plotting_widget/plotting_axes.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting.py b/sohstationviewer/view/plotting/plotting_widget/plotting.py index 14b250334..9e28f8d14 100644 --- a/sohstationviewer/view/plotting/plotting_widget/plotting.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting.py @@ -177,7 +177,8 @@ class Plotting: ax.set_ylim(-2, 2) self.plotting_axes.set_axes_info( ax, [len(points_list[0]), len(points_list[1])], - sample_no_colors=colors, + sample_no_colors=[clr[colors[0]], clr[colors[1]]], + sample_no_pos=[0.25, 0.75], chan_db_info=chan_db_info, linked_ax=linked_ax) if linked_ax is None: ax.x = x @@ -269,6 +270,7 @@ class Plotting: obj, c = cStr.split(':') colors[obj] = c l_color = 'G' + d_color = 'W' has_dot = False if 'L' in colors: l_color = colors['L'] diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py index ce0385e32..508f96cd2 100644 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py @@ -154,6 +154,7 @@ class PlottingAxes: def set_axes_info(self, ax: Axes, sample_no_list: List[int], sample_no_colors: List[str] = [clr['W'], clr['W']], + sample_no_pos: List[float] = [0.05, 0.95], label: Optional[str] = None, info: str = '', y_list: Optional[np.ndarray] = None, @@ -166,6 +167,8 @@ class PlottingAxes: :param ax: axes of a channel :param sample_no_list: list of totals of different sample groups :param sample_no_colors: list of color to display sample numbers + :param sample_no_pos: list of position to display sample numbers + top/bottom :param label: title of the plot. If None, show chan_db_info['label'] :param info: additional info to show in sub title which is smaller and under title on the left side @@ -242,7 +245,7 @@ class PlottingAxes: # variable for it. # bottom ax.text( - 1.005, 0.05, + 1.005, sample_no_pos[0], sample_no_list[0], horizontalalignment='left', verticalalignment='center', @@ -253,7 +256,7 @@ class PlottingAxes: ) # top ax.text( - 1.005, 0.95, + 1.005, sample_no_pos[1], sample_no_list[1], horizontalalignment='left', verticalalignment='center', -- GitLab