1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3## Add path to library (just for examples; you do not need this)
4import initExample
5
6import numpy as np
7from numpy import linspace
8from pyqtgraph.Qt import QtGui, QtCore
9import pyqtgraph as pg
10from pyqtgraph import MultiPlotWidget
11try:
12    from pyqtgraph.metaarray import *
13except:
14    print("MultiPlot is only used with MetaArray for now (and you do not have the metaarray package)")
15    exit()
16
17app = pg.mkQApp("MultiPlot Widget Example")
18mw = QtGui.QMainWindow()
19mw.resize(800,800)
20pw = MultiPlotWidget()
21mw.setCentralWidget(pw)
22mw.show()
23
24data = np.random.normal(size=(3, 1000)) * np.array([[0.1], [1e-5], [1]])
25ma = MetaArray(data, info=[
26    {'name': 'Signal', 'cols': [
27        {'name': 'Col1', 'units': 'V'},
28        {'name': 'Col2', 'units': 'A'},
29        {'name': 'Col3'},
30        ]},
31    {'name': 'Time', 'values': linspace(0., 1., 1000), 'units': 's'}
32    ])
33pw.plot(ma, pen='y')
34
35if __name__ == '__main__':
36    pg.exec()
37
38