diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py index 8a15edf521f9d0fb25470811bc3f7377318c30dd..a516bafce7552d7a26c3705ab6d75b46d3e04466 100755 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py @@ -2,6 +2,7 @@ Class of which object is used to plot data """ from typing import List, Optional, Union +import numpy as np import matplotlib.text from matplotlib import pyplot as pl from matplotlib.transforms import Bbox @@ -570,8 +571,11 @@ class PlottingWidget(QtWidgets.QScrollArea): new_max_y = None if hasattr(ax, 'x_list'): if not hasattr(ax, 'y_list'): - # dotForTime plots have attribute 'x_list' but not - # 'y_list' + # plot_time_dots and plot_multi_color_dots + x = ax.x_list[0] + new_x_indexes = np.where( + (x >= self.min_x) & (x <= self.max_x))[0] + ax.center_total_point_lbl.set_text(new_x_indexes.size) continue total_points = 0 tr_min_ys = [] @@ -591,16 +595,14 @@ 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) - elif hasattr(ax, 'x'): - total_points = len(ax.x) - if hasattr(ax, 'y') and len(ax.y) > 0: - new_min_y = min(ax.y) - new_max_y = max(ax.y) - ax.center_total_point_lbl.set_text(total_points) else: - # for case of having top and bottom total points - ax.bottom_total_point_lbl.set_text(len(ax.x0)) - ax.top_total_point_lbl.set_text(len(ax.x1)) + # 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(