from matplotlib import pyplot as plt class Plot1D: def __init__(self, *args, **kwargs): lines = plt.plot(*args, **kwargs) assert len(lines) == 1 self.plot = lines[0] #TODO: wtf? def set(self, value): self.plot.set_ydata(value)