On Mon, Dec 28, 2009 at 12:39 AM, Eric Firing <efir...@hawaii.edu> wrote: > So, which way is better? I assume the change is an improvement, because > the behavior with a list should be the same as with an ndarray. >
I agree with you. > > We could split the recaching up into parts that can be done independently on > x and y, and the part that has to be done when x and y are both set; this > would permit the separate x and y parts to be done by set_xdata and > set_ydata, which would freeze the data at that point, so that later changes > to the original arrays' contents would not affect the plot. (This would > also require forcing a copy instead of using asarray; this has a performance > penalty, but perhaps a negligible one.) This is similar to what I meant with option 1 in my previous post. > > Is it really worth fiddling with this, though? Unless there is a compelling > reason to change it, I am inclined to leave the present behavior alone until > the larger design is overhauled, so that unit-handling--which is the cause > of most of the fuss--is clearly and uniformly confined to a single layer of > the mpl stack. > I don't think I can make any compelling case here (I think this is more like a design choice and not something that need to be fixed). And I'm completely fine with leaving it as is. Anyhow, how about adding some words about this behavior in set_data. def set_data(self, *args): """ Set the x and y data. ACCEPTS: 2D array (rows are x, y) or two 1D arrays Note that a Line2D instatnce keeps a reference to the input. If the input is mutable (.e.g, list, numpy array) and its content changes after the set_data call, the plot may reflect the changes. A following meth:`recache` call will prevent it. """ Anyhow, the current code looks much cleaner than before, Thanks. -JJ > Eric > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users