Hi Lubos,
Lubos Vrbka wrote:
>> 1. Would it be possible to do only shallow copy of the arrays that are
>> being plotted so that on redrawing the figure, chanes in the datasets
>> would be picked up automatically? If not, is Line2D.set_data(...) the
>> right approach?
>>
> isn't this the way how the plotting is done? in my experience (iirc),
> the following thing works (x, y1, y2 are numpy arrays):
>
> pylab.ion()
>
> a, = pylab.plot(x,y1)
> b, = pylab.plot(x,y2)
> ...
> y1 += 10
> y2 += 20
>
> a.set_ydata(y1)
> b.set_ydata(y2)
> pylab.draw()
>
> y1 += 10
> y2 += 20
> a.set_ydata(y1)
> pylab.draw()
>
> in my experience BOTH plots get updated in this procedure, so i have to
> do first a deep copy in my case to get rid of these 'unwanted effects'...
>
If I understand correctly the len of X and Y will be changing,
therefore you may have to use set_data() function of Line2D
set_data(self, *args)
Set the x and y data
ACCEPTS: (array xdata, array ydata)
I seem to remember getting a size mismatch if X and Y grew in length and
I tried to use set_xdata() or set_ydata() separately.
YMMV
Steve
|