Update Lines in matplotlib
问题 I have a graph with multiple data sets on it. I need to continually redraw these lines, each separately, as the data is updated. How can I delete and reestablish it repeatedly, preferably without having to delete the entire graph and redraw all of the lines on it every time? 回答1: #!/usr/bin/env python import time from pylab import * ion() # turn interactive mode on # initial data x = arange(-8, 8, 0.1); y1 = sin(x) y2 = cos(x) # initial plot line1, line2, = plot(x, y1, 'r', x, y2, 'b') line1