2013-02-25 04:09:03 +00:00
|
|
|
"""
|
|
|
|
Display a plot and an image with minimal setup.
|
|
|
|
|
|
|
|
pg.plot() and pg.image() are indended to be used from an interactive prompt
|
|
|
|
to allow easy data inspection (but note that PySide unfortunately does not
|
|
|
|
call the Qt event loop while the interactive prompt is running, in this case
|
|
|
|
it is necessary to call QApplication.exec_() to make the windows appear).
|
|
|
|
"""
|
2012-03-17 15:47:20 +00:00
|
|
|
import initExample ## Add path to library (just for examples; you do not need this)
|
2011-04-05 16:53:05 +00:00
|
|
|
|
2013-02-25 04:09:03 +00:00
|
|
|
|
2012-03-02 02:55:32 +00:00
|
|
|
import numpy as np
|
2011-04-05 16:53:05 +00:00
|
|
|
import pyqtgraph as pg
|
|
|
|
|
2012-03-02 02:55:32 +00:00
|
|
|
data = np.random.normal(size=1000)
|
|
|
|
pg.plot(data, title="Simplest possible plotting example")
|
|
|
|
|
|
|
|
data = np.random.normal(size=(500,500))
|
2013-02-25 04:09:03 +00:00
|
|
|
pg.image(data, title="Simplest possible image example")
|
2011-04-05 16:53:05 +00:00
|
|
|
|
|
|
|
|
2012-03-17 15:47:20 +00:00
|
|
|
## Start Qt event loop unless running in interactive mode or using pyside.
|
2012-12-05 05:25:45 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys
|
|
|
|
if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
|
2013-02-25 04:09:03 +00:00
|
|
|
pg.QtGui.QApplication.exec_()
|