Skip to content
Snippets Groups Projects

Change to use matplotlib's lim for zooming

Merged Lan Dam requested to merge i118_lim_for_zooming into master
1 file
+ 13
11
Compare changes
  • Side-by-side
  • Inline
@@ -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(
Loading