Skip to content

Commit 99926ee

Browse files
authored
Merge pull request #173 from chrishalcrow/update-waveform-range-again
Let `pyqtgraph` deal with waveform range
2 parents 31ef972 + 20e1626 commit 99926ee

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
@@ -365,11 +365,6 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
365365
from .myqt import QT
366366
import pyqtgraph as pg
367367

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

375370
if self.xvect is None:
@@ -434,8 +429,8 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
434429
self.plot1.addItem(fill)
435430

436431
self.plot1.addItem(curve)
437-
438-
432+
433+
439434
if self.settings['show_channel_id']:
440435
for chan_ind in common_channel_indexes:
441436
chan_id = self.controller.channel_ids[chan_ind]
@@ -445,17 +440,9 @@ def _qt_refresh_mode_geometry(self, dict_visible_units, keep_range, auto_zoom):
445440
self.plot1.addItem(itemtxt)
446441
itemtxt.setPos(x, y)
447442

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

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

460447

461448
def _qt_refresh_one_spike(self):

0 commit comments

Comments
 (0)