Example #1
0
        elif tStart < xl:
            self.faaTempPlot.setXRange(tStart - 0.1 * span,
                                       tStart + 0.9 * span)
        elif tEnd > xr:
            self.faaTempPlot.setXRange(tEnd - 0.9 * span, tEnd + 0.1 * span)

    def removeTimeSpanHighlight(self):
        if self.lri is not None:
            self.faaTempPlot.removeItem(self.lri)
            self.lri = None


if __name__ == '__main__':
    from qtpy.QtGui import QApplication
    #from qtpy.QtCore import QTimer
    import h5py as hdf
    path = 'ExampleData/'
    fileName = path + 'TES2_IV_20180117_090049.h5'

    app = QApplication([])
    from Analysis.HkImport import HkImporter

    f = hdf.File(fileName, 'r')
    hkGroup = f['HK']
    hk = HkImporter(hkGroup)
    mw = HkDockWidget(hk)
    mw.show()
    #QTimer.singleShot(3000, lambda: mw.setSelection('up+/up-'))

    app.exec_()
Example #2
0
#===============================================================================
#   Example
#===============================================================================
if __name__ == '__main__':
    import sys
    from qtpy.QtGui import QMainWindow, QApplication
    from numpy import linspace

    class ApplicationWindow(QMainWindow):
        def __init__(self):
            QMainWindow.__init__(self)
            self.mplwidget = MatplotlibWidget(self,
                                              title='Example',
                                              xlabel='Linear scale',
                                              ylabel='Log scale',
                                              hold=True,
                                              yscale='log')
            self.mplwidget.setFocus()
            self.setCentralWidget(self.mplwidget)
            self.plot(self.mplwidget.axes)

        def plot(self, axes):
            x = linspace(-10, 10)
            axes.plot(x, x**2)
            axes.plot(x, x**3)

    app = QApplication(sys.argv)
    win = ApplicationWindow()
    win.show()
    sys.exit(app.exec_())