On Thu, Feb 2, 2012 at 3:52 PM, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:

> 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[:]
>
>
I forget if this approach is recommended or not.  There are methods for ax
that properly handle removal of types of artists that have been attached to
an axes.  The above approach assumes that no other collections have been
plotted that you wanted to keep.  The approach I gave is a very surgical
method that makes sure that only what is supposed to be removed gets
removed.  Both are valid, and their usefulness depends upon which view of
the data you need (remove types of artists versus removing particular
artists).


> 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).
>
>
That would be a bug and should be reported (assuming that it is in the
latest version).  Make sure that you are using at least v1.0.1 (preferably
v1.1.0) to make sure that show() should do what you want.  Any version
earlier than v1.0.1 is very unpredictable with respect to multiple show()
calls.

Ben Root
------------------------------------------------------------------------------
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