On 2/2/2012 3:41 PM, Benjamin Root wrote:
On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr <jim.st...@gmail.com <mailto:jim.st...@gmail.com>> wrote:

    Hello-

    Scenario:

    Basemap used to display the East Coast of the US and the Atlantic Ocean.
    Shapelib is used read a shapefile the contents of is pumped into a PyPlot
    subplot hosted Line Collection which overlays the ocean with a grid
    PyPlot text is used to label each grid with it's designator.

    What I want to do is plot a collection of points, save the result as a PNG,
    clear the first set of points, plot another collection of points, save the
    result, and so on.  The problem is the if I use the Pyplot clf function it
    wipes
    everything previously built.

    What do I need to do in order to clear just the points without clearing
    everything?

    Thank you.

    Jim


Jim,

Sorry for the delay. Most plotting functions in matplotlib returns a Collection object. These objects have a member function "remove()".

>>> import matplotlib.pyplot as plt
>>> plt.ion()
>>> plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0])
>>> pts = plt.scatter([1, 2, 3], [1, 2, 3])
>>> plt.show()    # You see three points and a line
>>> res.remove()
>>> plt.show()   # Now you see only the line


I hope that helps!
Ben Root

Ben-

Very helpful. A question, how do you determine the object designator? In your example above, res.remove(), where did the 'res' come from?

Jim
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to