Skip to content

Commit 20e1626

Browse files
committed
Let pyqtgraph deal with waveform range
1 parent e18a758 commit 20e1626

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

spikeinterface_gui/waveformview.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
364364
from .myqt import QT
365365
import pyqtgraph as pg
366366

367-
if self._x_range is not None and keep_range:
368-
#this may change with pyqtgraph
369-
self._x_range = tuple(self.viewBox1.state['viewRange'][0])
370-
self._y1_range = tuple(self.viewBox1.state['viewRange'][1])
371-
372367
self.plot1.clear()
373368

374369
if self.xvect is None:
@@ -433,8 +428,8 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
433428
self.plot1.addItem(fill)
434429

435430
self.plot1.addItem(curve)
436-
437-
431+
432+
438433
if self.settings['show_channel_id']:
439434
for chan_ind in common_channel_indexes:
440435
chan_id = self.controller.channel_ids[chan_ind]
@@ -444,17 +439,9 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
444439
self.plot1.addItem(itemtxt)
445440
itemtxt.setPos(x, y)
446441

447-
if self._x_range is None or not keep_range:
448-
449-
x_margin = 15
450-
y_margin = 20
451-
self._x_range = np.min(xvects) - x_margin , np.max(xvects) + x_margin
452-
453-
channel_positions_y = self.contact_location[common_channel_indexes,1]
454-
self._y1_range = np.min(channel_positions_y) - y_margin , np.max(channel_positions_y) + y_margin
442+
if not keep_range:
443+
self.plot1.autoRange(padding = 0.1)
455444

456-
self.plot1.setXRange(*self._x_range, padding = 0.0)
457-
self.plot1.setYRange(*self._y1_range, padding = 0.0)
458445

459446

460447
def _qt_refresh_one_spike(self):

0 commit comments

Comments
 (0)