(self, y)
| 28 | self.ax.set_xlim(0, self.maxt) |
| 29 | |
| 30 | def update(self, y): |
| 31 | lastt = self.tdata[-1] |
| 32 | if lastt >= self.tdata[0] + self.maxt: # reset the arrays |
| 33 | self.tdata = [self.tdata[-1]] |
| 34 | self.ydata = [self.ydata[-1]] |
| 35 | self.ax.set_xlim(self.tdata[0], self.tdata[0] + self.maxt) |
| 36 | self.ax.figure.canvas.draw() |
| 37 | |
| 38 | # This slightly more complex calculation avoids floating-point issues |
| 39 | # from just repeatedly adding `self.dt` to the previous value. |
| 40 | t = self.tdata[0] + len(self.tdata) * self.dt |
| 41 | |
| 42 | self.tdata.append(t) |
| 43 | self.ydata.append(y) |
| 44 | self.line.set_data(self.tdata, self.ydata) |
| 45 | return self.line, |
| 46 | |
| 47 | |
| 48 | def emitter(p=0.1): |
no test coverage detected