from theme import pg_plot_style class PlotDescription: def __init__(self, title=None, xlabel=None, ylabel=None): self.title = title self.xlabel = xlabel self.ylabel = ylabel self.xs = [] self.ys = [] self.style = pg_plot_style() @property def data(self): return (self.xs, self.ys) def append(self, xy): x, y = xy self.xs.append(x) self.ys.append(y) def make_plot(self, plotwidget): res = plotwidget.plot(self.xs, self.ys, **self.style) if self.title: plotwidget.setTitle(self.title) if self.xlabel: plotwidget.setLabel("bottom", self.xlabel) if self.ylabel: plotwidget.setLabel("left", self.ylabel) return res