[change] removed axes on startup

This commit is contained in:
Marcel Paffrath 2017-06-08 16:58:44 +02:00
parent d6dd8bfaa8
commit b061c81b2c
3 changed files with 33 additions and 14 deletions

View File

@ -214,7 +214,7 @@ class MainWindow(QMainWindow):
self.tabs.currentChanged.connect(self.refreshTabs)
# create central matplotlib figure canvas widget
plottitle = "Overview: {0} components ".format(self.getComponent())
plottitle = None#"Overview: {0} components ".format(self.getComponent())
if pg:
self.pg = True
self.dataPlot = WaveformWidgetPG(parent=self, xlabel=xlab, ylabel=None,
@ -1239,13 +1239,20 @@ class MainWindow(QMainWindow):
self.ae_id = None
self.scroll_id = None
def finishWaveformDataPlot(self):
if self.pg:
def finish_pg_plot(self):
self.getPlotWidget().updateWidget()
plots = self.wfp_thread.data
for times, data in plots:
self.dataPlot.plotWidget.getPlotItem().plot(times, data, pen='k')
self.dataPlot.reinitMoveProxy()
self.dataPlot.plotWidget.showAxis('left')
self.dataPlot.plotWidget.showAxis('bottom')
def finishWaveformDataPlot(self):
if self.pg:
self.finish_pg_plot()
else:
self._max_xlims = self.dataPlot.getXLims()
plotWidget = self.getPlotWidget()
plotDict = plotWidget.getPlotDict()
pos = plotDict.keys()
@ -1255,7 +1262,6 @@ class MainWindow(QMainWindow):
plotWidget.figure.tight_layout()
except:
pass
#self._max_xlims = self.dataPlot.getXLims()
self.connectWFplotEvents()
self.loadlocationaction.setEnabled(True)
self.auto_tune.setEnabled(True)
@ -1709,7 +1715,7 @@ class MainWindow(QMainWindow):
fill = pg.FillBetweenItem(spe_l, spe_r, brush=colors[1].brush())
fb = pw.addItem(fill)
except:
print('Could not create fill for SPE.')
print('Warning: drawPicks: Could not create fill for symmetric pick error.')
pw.plot([mpp, mpp], ylims, pen=colors[2], name='{}-Pick'.format(phase))
else:
pw.plot([mpp, mpp], ylims, pen=colors[0], name='{}-Pick (NO PICKERROR)'.format(phase))

View File

@ -1 +1 @@
909e-dirty
d6dd-dirty

View File

@ -413,11 +413,14 @@ class WaveformWidgetPG(QtGui.QWidget):
self.plotdict = dict()
# create plot
self.main_layout = QtGui.QVBoxLayout()
self.label = QtGui.QLabel()
self.setLayout(self.main_layout)
self.plotWidget = pg.PlotWidget(title=title, autoDownsample=True)
self.main_layout.addWidget(self.plotWidget)
#self.plotWidget.setMouseEnabled(False, False)
self.main_layout.addWidget(self.label)
self.plotWidget.showGrid(x=False, y=True, alpha=0.2)
self.plotWidget.hideAxis('bottom')
self.plotWidget.hideAxis('left')
self.reinitMoveProxy()
self._proxy = pg.SignalProxy(self.plotWidget.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
@ -431,9 +434,12 @@ class WaveformWidgetPG(QtGui.QWidget):
pos = evt[0] ## using signal proxy turns original arguments into a tuple
if self.plotWidget.sceneBoundingRect().contains(pos):
mousePoint = self.plotWidget.getPlotItem().vb.mapSceneToView(pos)
# index = int(mousePoint.x())
# if index > 0 and index < len(data1):
# label.setText("<span style='font-size: 12pt'>x=%0.1f, <span style='color: red'>y1=%0.1f</span>, <span style='color: green'>y2=%0.1f</span>" % (mousePoint.x(), data1[index], data2[index]))
x, y, = (mousePoint.x(), mousePoint.y())
#if x > 0:# and index < len(data1):
wfID = self._parent.getWFID(y)
station = self._parent.getStationName(wfID)
if self._parent.get_current_event():
self.label.setText("station = {}, t = {} [s]".format(station, x))
self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y())
@ -456,7 +462,6 @@ class WaveformWidgetPG(QtGui.QWidget):
noiselevel=None, scaleddata=False, mapping=True,
component='*', nth_sample=1, iniPick=None):
self.title = title
#self.plotWidget.clear()
self.clearPlotDict()
wfstart, wfend = full_range(wfdata)
nmax = 0
@ -482,6 +487,14 @@ class WaveformWidgetPG(QtGui.QWidget):
nsc.reverse()
plots = []
try:
self.plotWidget.getPlotItem().vb.setLimits(xMin=wfstart,
xMax=wfend,
yMin=-0.5,
yMax=len(nsc)+0.5)
except:
print('Warning: Could not set zoom limits')
for n, (network, station, channel) in enumerate(nsc):
st = wfdata.select(network=network, station=station, channel=channel)
trace = st[0]