From ef61fd0184e9f6058c3199d3c81f6fb68cf26c9b Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Fri, 25 Aug 2023 11:24:04 -0600 Subject: [PATCH] when zooming, set_axes_ylim only perform when total_points > 1 to prevent the shape of plot collapse into one line --- .../view/plotting/plotting_widget/plotting_widget.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py index 69956159b..61571322b 100755 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py @@ -606,12 +606,13 @@ class PlottingWidget(QtWidgets.QScrollArea): if tr_min_ys != []: new_min_y = min(tr_min_ys) new_max_y = max(tr_max_ys) + # in case total_points == 1, y lim shouldn't be set + # again or the plot would be collapsed to one line + if total_points > 1: + self.plotting_axes.set_axes_ylim( + ax, new_min_y, new_max_y) ax.center_total_point_lbl.set_text(total_points) - if new_min_y is not None: - self.plotting_axes.set_axes_ylim( - ax, new_min_y, new_max_y, ax.chan_db_info) - def draw(self): """ Update drawing on the widget. -- GitLab