class Trace: def __init__(self, descrStr): self.descr = descrStr self.values = None self.label = None self.unit = None self.attributes = {} def plot(self): import matplotlib.pyplot as plt plt.plot(self.values, label=self.descr) plt.legend() class TraceXY: def __init__(self, descrStr): self.descr = descrStr self.x = Trace('x_values') self.y = Trace('y_values') def plot(self): import matplotlib.pyplot as plt plt.plot(self.x.values, self.y.values, label=self.descr) plt.legend() plt.xlabel(self.x.label) class TraceSetSameX: def __init__(self, descrStr): self.descr = descrStr self.x = Trace('x_values') self.traces={} def addTrace(self, tr): if len(self.traces) == 0: self.x = tr.x trY = tr.y self.traces[tr.descr]=trY def plot(self): import matplotlib.pyplot as plt for k, tr in self.traces.items(): tr.plot() plt.xlabel(self.x.label) plt.legend()