From: Jerzy K. <jer...@un...> - 2012-02-02 21:52:24
|
Benjamin Root : > Just about any mpl plotting function (plot(), scatter(), hist(), etc.) > returns an object. Most of the time, users do not save the result > into a variable, but if you want to do advanced tricks, you will need > to save those returns. Sorry for a shameless attempt to add something to this, but actually here you don't need it, these collections are accessible through the current axes: plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) pts = plt.scatter([1, 2, 3], [1, 2, 3]) ax=plt.gca() ... del ax.collections[:] (Or, say, del ax.lines[:] to remove the first line ; I do it often when I plot a solution of a differential equation, a trajectory, keeping just a few last segments). == This reminds me a nuisance... Under Windows XP, ion() is not too compatible with show(). TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and without draw() nothing is plotted). Jerzy Karczmarczuk |