From f5053b949c26d5cc7323831607d4af048f93fd3b Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Thu, 24 Aug 2023 12:14:50 -0600 Subject: [PATCH] change x0 to x_bottom, x_1 to x_top to be more descriptive --- .../view/plotting/plotting_widget/plotting.py | 4 ++-- .../plotting_widget/plotting_widget.py | 20 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting.py b/sohstationviewer/view/plotting/plotting_widget/plotting.py index 7eabd46ff..44389d328 100644 --- a/sohstationviewer/view/plotting/plotting_widget/plotting.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting.py @@ -181,8 +181,8 @@ class Plotting: sample_no_pos=[0.25, 0.75], chan_db_info=chan_db_info, linked_ax=linked_ax) - ax.x0 = np.array(points_list[0]) - ax.x1 = np.array(points_list[1]) + ax.x_bottom = np.array(points_list[0]) + ax.x_top = np.array(points_list[1]) ax.chan_db_info = chan_db_info return ax diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py index a516bafce..69956159b 100755 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py @@ -569,6 +569,18 @@ class PlottingWidget(QtWidgets.QScrollArea): if not first_time: new_min_y = None new_max_y = None + if hasattr(ax, 'x_top'): + # plot_up_down_dots + new_x_bottom_indexes = np.where( + (ax.x_bottom >= self.min_x) & + (ax.x_bottom <= self.max_x))[0] + ax.bottom_total_point_lbl.set_text( + new_x_bottom_indexes.size) + new_x_top_indexes = np.where( + (ax.x_top >= self.min_x) & + (ax.x_top <= self.max_x))[0] + ax.top_total_point_lbl.set_text( + new_x_top_indexes.size) if hasattr(ax, 'x_list'): if not hasattr(ax, 'y_list'): # plot_time_dots and plot_multi_color_dots @@ -595,14 +607,6 @@ class PlottingWidget(QtWidgets.QScrollArea): new_min_y = min(tr_min_ys) new_max_y = max(tr_max_ys) ax.center_total_point_lbl.set_text(total_points) - else: - # plot_up_down_dots - new_x0_indexes = np.where( - (ax.x0 >= self.min_x) & (ax.x0 <= self.max_x))[0] - ax.bottom_total_point_lbl.set_text(new_x0_indexes.size) - new_x1_indexes = np.where( - (ax.x1 >= self.min_x) & (ax.x1 <= self.max_x))[0] - ax.top_total_point_lbl.set_text(new_x1_indexes.size) if new_min_y is not None: self.plotting_axes.set_axes_ylim( -- GitLab