I need to delete all the lines on a subplot, to then redraw them (i'm making a redraw function to be used when i add/remove some lines) How do I do it?
Asked
Active
Viewed 7,807 times
2 Answers
6
If you have the Axes
object stored, you reference each line by the lines
member:
ax = fig.add_subplot(111)
ax.plot(line one)
ax.plot(line two)
# plot
ax.lines.pop(0) # removes the first line
# plot again

Steve Tjoa
- 59,122
- 18
- 90
- 101