|
From: Christopher B. <Chr...@no...> - 2006-06-01 16:46:42
|
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
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|