blob: ef4404183a1e72ecd6dd1304f254e187cf1cbe7f (
plain)
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
45
46
47
48
49
50
51
|
class TraceYonly:
def __init__(self, descrStr):
self.descr = descrStr
self.y = None
self.ylabel = None
self.yunit = None
def plot(self):
import matplotlib.pyplot as plt
plt.plot(self.y, label=self.descr)
plt.legend()
class Trace(TraceYonly):
def __init__(self, descrStr):
super().__init__(descrStr)
self.x = None
self.xlabel = None
self.xunit = None
def plot(self):
import matplotlib.pyplot as plt
plt.plot(self.x, self.y, label=self.descr)
plt.legend()
class TraceSetSameX:
def __init__(self, descrStr):
self.descr = descrStr
self.x = None
self.xlabel = None
self.xunit = None
self.traces={}
def addTrace(self, tr):
if len(self.traces) == 0:
self.x = tr.x
self.xlabel = tr.xlabel
self.xunit = tr.xunit
trY = TraceYonly(tr.descr)
trY.y = tr.y
trY.ylabel = tr.ylabel
trY.yunit = tr.yunit
self.traces[trY.descr]=trY
def plot(self):
import matplotlib.pyplot as plt
for k, v in self.traces.items():
plt.plot(self.x, v.y, label=v.descr)
plt.legend()
|