[Matplotlib-users] [matplotlib-users] How "connect" axes on matplotlib subplots

2012-02-02 Thread Fabien Lafont
Hello!

How can I zoom exactly on the same region on two different subplots at
the same time. This option is enable when I use plotfile but not if I
use plot, and subplots?

Thx!
Fabien

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


Re: [Matplotlib-users] [matplotlib-users] How "connect" axes on matplotlib subplots

2012-02-02 Thread Angus McMorland
On 2 February 2012 08:32, Fabien Lafont  wrote:
> Hello!
>
> How can I zoom exactly on the same region on two different subplots at
> the same time. This option is enable when I use plotfile but not if I
> use plot, and subplots?

Create the first axes object, then when you create subsequent ones,
pass the first as the value of the sharex and sharey keywords to the
subplot or add_axes command.
See this page [1] for a quick example.

Angus

[1] 
http://matplotlib.sourceforge.net/users/recipes.html?highlight=sharex%20subplot

> Thx!
> Fabien
>
> --
> 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



-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh

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


Re: [Matplotlib-users] [matplotlib-users] How "connect" axes on matplotlib subplots

2012-02-02 Thread Fabien Lafont
Thx!

2012/2/2 Angus McMorland :
> On 2 February 2012 08:32, Fabien Lafont  wrote:
>> Hello!
>>
>> How can I zoom exactly on the same region on two different subplots at
>> the same time. This option is enable when I use plotfile but not if I
>> use plot, and subplots?
>
> Create the first axes object, then when you create subsequent ones,
> pass the first as the value of the sharex and sharey keywords to the
> subplot or add_axes command.
> See this page [1] for a quick example.
>
> Angus
>
> [1] 
> http://matplotlib.sourceforge.net/users/recipes.html?highlight=sharex%20subplot
>
>> Thx!
>> Fabien
>>
>> --
>> 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
>
>
>
> --
> AJC McMorland
> Post-doctoral research fellow
> Neurobiology, University of Pittsburgh

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


[Matplotlib-users] [matplotlib-users] Set the color of a plot in argument's function

2012-02-02 Thread Fabien Lafont
I don't manage to put the color of my plot in the argument' list function.

Example:

def function(color):

  plot(x,y,'.', color, label = "this is my curve")


function('r')

even if I put function(" 'r' ")  it doesn't work.

Any idea?

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


Re: [Matplotlib-users] [matplotlib-users] Set the color of a plot in argument's function

2012-02-02 Thread Daryl Herzmann
On Thu, Feb 2, 2012 at 8:52 AM, Fabien Lafont  wrote:
> I don't manage to put the color of my plot in the argument' list function.
>
> Example:
>
> def function(color):
>
>      plot(x,y,'.', color, label = "this is my curve")
>
>
> function('r')
>
> even if I put function(" 'r' ")  it doesn't work.
>
> Any idea?

I would suggest using named arguments for everything other than x and y,  so

plot(x,y,marker=',', color=color, label='this is my curve')

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=plot#matplotlib.axes.Axes.plot

daryl

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


Re: [Matplotlib-users] [matplotlib-users] Set the color of a plot in argument's function

2012-02-02 Thread Fabien Lafont
Thanks Daryl, it works!

2012/2/2 Daryl Herzmann :
> On Thu, Feb 2, 2012 at 8:52 AM, Fabien Lafont  wrote:
>> I don't manage to put the color of my plot in the argument' list function.
>>
>> Example:
>>
>> def function(color):
>>
>>      plot(x,y,'.', color, label = "this is my curve")
>>
>>
>> function('r')
>>
>> even if I put function(" 'r' ")  it doesn't work.
>>
>> Any idea?
>
> I would suggest using named arguments for everything other than x and y,  so
>
> plot(x,y,marker=',', color=color, label='this is my curve')
>
> http://matplotlib.sourceforge.net/api/axes_api.html?highlight=plot#matplotlib.axes.Axes.plot
>
> daryl

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


[Matplotlib-users] How "connect" axes on matplotlib subplots

2012-02-02 Thread Sterling Smith
> Hello!
> 
> How can I zoom exactly on the same region on two different subplots at
> the same time. This option is enable when I use plotfile but not if I
> use plot, and subplots?
> 
> Thx!
> Fabien

Fabien,

When you create the new subplots, add the sharex=ax, sharey=ax keywords, where 
ax is the first set of axes you create.

-Sterling
--
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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Benjamin Root
On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr  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
--
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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Jim St.Cyr

On 2/2/2012 3:41 PM, Benjamin Root wrote:
On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr > 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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Benjamin Root
On Thu, Feb 2, 2012 at 2:54 PM, Jim St.Cyr  wrote:

>  On 2/2/2012 3:41 PM, Benjamin Root wrote:
>
> On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr  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
>

It was assigned when I called scatter().  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.

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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread G Jones
Note there is a typo. Ben assigned the output to "pts" but then referenced
"res".

On Thu, Feb 2, 2012 at 12:59 PM, Benjamin Root  wrote:

> On Thu, Feb 2, 2012 at 2:54 PM, Jim St.Cyr  wrote:
>
>>  On 2/2/2012 3:41 PM, Benjamin Root wrote:
>>
>> On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr  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
>>
>
> It was assigned when I called scatter().  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.
>
> 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
>
>
--
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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Benjamin Root
On Thu, Feb 2, 2012 at 3:04 PM, G Jones  wrote:

> Note there is a typo. Ben assigned the output to "pts" but then referenced
> "res".
>
>
Good catch!

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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Jerzy Karczmarczuk
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




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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Benjamin Root
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


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Jerzy Karczmarczuk

Benjamin Root on my suggestion that one can use del instead of remove :
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).



Yes, absolutely.
With just a little remark: remove is a Python function which *searches* 
the list for a given value. del uses indices, so

del lst[1]
will be most probably faster than lst.remove(value), if this value 
happens to occur for the first time at index 1. Unless Matplotlib 
uses a specially tuned version of remove.




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.
I use 1.1.0. (Python 2.7.2) I didn't report any bug because I didn't 
know whether this was a bug...

But there are more...
The animation module uses various timers depending on the back-end. This 
is -- perhaps -- the result of the fact that Python standard Timer (a 
subclass of Thread) is, to say it mildly, rather weak. So, under Tk the 
system uses after(), wx offers its timers, etc. Timed animation works 
differently under various backends.


Here:

http://users.info.unicaen.fr/~karczma/TEACH/Test/isingVZ.py

is a program which simulates/visualizes a simple-minded 2D Ising model 
(vectorized Metropolis Monte-Carlo; not *exactly* physical, but only 
mister Nobody is perfect...). It should update the picture dynamically, 
and my students can see how the ferromagnetic domains develop.
When run with Tk, OK. GTK and wx -- no. The animation runs, but the 
figure is frozen for many seconds, and it is updated when the Slider is 
activated. The autonomous refreshing of the image is much much slower 
than under TK. I don' understand what is happening...
Tested on Windows XP, and under Linux (Fedora). I repeat, the animation 
runs, this is a problem of refreshing the display.


Thank you, and all the best.

Jerzy Karczmarczuk


--
Try before you buy = See our experts in action!
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-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How Clear Points Without Wiping Everything?

2012-02-02 Thread Benjamin Root
On Thu, Feb 2, 2012 at 6:25 PM, Jerzy Karczmarczuk <
jerzy.karczmarc...@unicaen.fr> wrote:

>  Benjamin Root on my suggestion that one can use del instead of remove :
>
>  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).
>
>  Yes, absolutely.
> With just a little remark: remove is a Python function which *searches*
> the list for a given value. del uses indices, so
> del lst[1]
> will be most probably faster than lst.remove(value), if this value happens
> to occur for the first time at index 1. Unless Matplotlib uses a
> specially tuned version of remove.
>
>
Don't confuse Python's remove() method for lists with the remove() method
for matplotlib Artist (and subclassed Artists) objects.  Collections are a
subclass of Artist, and remove() simply means "remove me from the Axes
object I was connected to".  This is because an Axes object contains lists
to the artists, collections and others that have been attached to it, and
each Artist has a reference to the Axes object that it was connected to.
So, calling remove() on an Artist will do all the appropriate house-keeping.

matplotlib Artist objects do not implement __del__(), so deleting an Artist
before calling remove() will not properly disconnect all of the callbacks
and references.  I suspect that the only reason why this works at all is
that there is a lot of usage of weakrefs and it so there might be enough
error-checking to keep everything from crashing.

Others who are much more familiar with the underlying architecture may be
able to comment better.  In the meantime, the pedantic, better form of:

del ax.collections[:]

would be:

for item in ax.collections :
item.remove()
del ax.collections[:]




>
>
>> 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.
>
> I use 1.1.0. (Python 2.7.2) I didn't report any bug because I didn't know
> whether this was a bug...
>

Then, please do report it.


>  But there are more...
> The animation module uses various timers depending on the back-end. This
> is -- perhaps -- the result of the fact that Python standard Timer (a
> subclass of Thread) is, to say it mildly, rather weak. So, under Tk the
> system uses after(), wx offers its timers, etc. Timed animation works
> differently under various backends.
>

This should also be a new thread, and possibly a new bug report as well.

Ben Root
--
Try before you buy = See our experts in action!
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-dev2___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users