File: taurusplot03.py

package info (click to toggle)
taurus 3.0.0-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 87,664 kB
  • sloc: python: 56,016; sh: 16; makefile: 14
file content (44 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python

import sys
from PyQt4 import Qt
from taurus.qt.qtgui.plot import TaurusPlot, CurveAppearanceProperties

app = Qt.QApplication(sys.argv)
##########################
#BEGIN EXAMPLE CODE
##########################

import numpy
from PyQt4 import Qwt5

panel = TaurusPlot()

rawdata1 = {"y":5*numpy.random.random(10), "name":"Random"}
rawdata2 = {"x":[1, 2, 5, 7], "y":[2, 3, 1, 4], "name":"Hand-written"}
rawdata3 = {"x":numpy.arange(0,10,0.1), "f(x)":"sqrt(x)"}

p1 = CurveAppearanceProperties(sStyle=Qwt5.QwtSymbol.Rect,
                               sSize=5,
                               sColor="green",
                               sFill=False,
                               lStyle=Qt.Qt.NoPen)

p2 = CurveAppearanceProperties(sStyle=Qwt5.QwtSymbol.Triangle,
                               sSize=8,
                               sColor="red",
                               sFill=True,
                               lColor="red",
                               lStyle=Qt.Qt.DashLine)

panel.attachRawData(rawdata1, properties=p1)
panel.attachRawData(rawdata2, properties=p2)
panel.attachRawData(rawdata3)



########################
#END EXAMPLE CODE
########################
panel.setVisible(True)
sys.exit(app.exec_())