Skip to content
Snippets Groups Projects
Commit 3fcd4f00 authored by Lan Dam's avatar Lan Dam
Browse files

recalculate total points for plot_time_dots, plot_multi_color_dots and plot_up_down_dots

parent 9d993577
No related branches found
No related tags found
3 merge requests!149Fix bug happen when zooming in overlap section,!148fix zooming, order, y for the combination of 2 channels GPS_lk_Unlk and GPS_clock_power,!145Change to use matplotlib's lim for zooming
Pipeline #2781 passed with stage
in 3 minutes
This commit is part of merge request !145. Comments created here will be created in the context of that merge request.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Class of which object is used to plot data Class of which object is used to plot data
""" """
from typing import List, Optional, Union from typing import List, Optional, Union
import numpy as np
import matplotlib.text import matplotlib.text
from matplotlib import pyplot as pl from matplotlib import pyplot as pl
from matplotlib.transforms import Bbox from matplotlib.transforms import Bbox
...@@ -570,8 +571,11 @@ class PlottingWidget(QtWidgets.QScrollArea): ...@@ -570,8 +571,11 @@ class PlottingWidget(QtWidgets.QScrollArea):
new_max_y = None new_max_y = None
if hasattr(ax, 'x_list'): if hasattr(ax, 'x_list'):
if not hasattr(ax, 'y_list'): if not hasattr(ax, 'y_list'):
# dotForTime plots have attribute 'x_list' but not # plot_time_dots and plot_multi_color_dots
# 'y_list' 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 continue
total_points = 0 total_points = 0
tr_min_ys = [] tr_min_ys = []
...@@ -591,16 +595,14 @@ class PlottingWidget(QtWidgets.QScrollArea): ...@@ -591,16 +595,14 @@ class PlottingWidget(QtWidgets.QScrollArea):
new_min_y = min(tr_min_ys) new_min_y = min(tr_min_ys)
new_max_y = max(tr_max_ys) new_max_y = max(tr_max_ys)
ax.center_total_point_lbl.set_text(total_points) 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: else:
# for case of having top and bottom total points # plot_up_down_dots
ax.bottom_total_point_lbl.set_text(len(ax.x0)) new_x0_indexes = np.where(
ax.top_total_point_lbl.set_text(len(ax.x1)) (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: if new_min_y is not None:
self.plotting_axes.set_axes_ylim( self.plotting_axes.set_axes_ylim(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment