Jae-Joon Lee wrote: > On Sun, Dec 27, 2009 at 7:31 PM, Eric Firing <efir...@hawaii.edu> wrote: >> I don't understand what your script, below, is intended to do or show. I >> haven't run it with mpl prior to my change. With the change, it simply >> draws a single line, or at least that is all I see on the plot. > > Before your change, it draws two different lines.
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. > > Anyhow, another example, > > import matplotlib.pyplot as plt > > ax = plt.subplot(111) > a = [0, 1] > l1, = ax.plot(a) > l1.set_ydata(a) > a[1] = 0.5 > > plt.show() > > The above code draws a line from (0,0) to (1, 0.5), not (0,0) to > (1,1). And my question is whether we want this behavior. I don't think it matters much. The present behavior is not unreasonable. > > I think the issue is more subtle. If the recaching is done somehow > before the mutable data changes, the change has no effect. On the > other hand, if the recaching is done after the change (as in the above > example), the change is effective. 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.) 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. Eric > > Regards, > > -JJ ------------------------------------------------------------------------------ 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