MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / update

Method update

galleries/examples/animation/strip_chart.py:30–45  ·  view source on GitHub ↗
(self, y)

Source from the content-addressed store, hash-verified

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
48def emitter(p=0.1):

Callers 15

annotate_heatmapFunction · 0.45
axis_direction.pyFile · 0.45
scalarformatter.pyFile · 0.45
__init__Method · 0.45
customize_rc.pyFile · 0.45
__init__Method · 0.45
add_toolbarMethod · 0.45
add_toolbarMethod · 0.45
init_plot_dataMethod · 0.45

Calls 3

set_xlimMethod · 0.45
drawMethod · 0.45
set_dataMethod · 0.45

Tested by

no test coverage detected