Christopher Barker wrote:
Louis,

This is standard num* array behavior: arrays are mutable, and MPL is not making copies of them when you plot, which is a good thing.

by the way, slices of arrays are references too, which is different than python lists, so it can be surprising, but also useful

             # 1st Plot .................
       x[0]= 1.0
       y[0]= 1.0
       x[1]=-1.0
       y[1]=-1.0
       a.plot(x,y)

       # 2nd Plot .................

now you need copies. You can make brand new ones, or use the copy() method:
x = x.copy()
y = y.copy()

you could also pass a copy into the plot method:

a.plot(x.copy(), y.copy())

which is perhaps the behavior you were expecting.

-Chris

Thanks, Chris. I sort of figured this out, but you put it clearer and I like the copy suggestion. I'll use it. It sure drove me nuts for a while. :-)

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC  20375
USA
Ph:  +202-767-6002
email:  [EMAIL PROTECTED]



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to