Hi,
the refreshdata command, intended to update plot data selectively, doesn't
work as I'd expect.
It seems all graphics data is redrawn, not only changed data.
Consider the following example:
x = 0:0.1:10;
y1 = sin (x);
y2 = cos (x);
subplot ( 1, 2, 1) ;
plot (x, y1, "ydatasource", "y1");
subplot ( 1, 2, 2) ;
plot (x, y2, "color",[1, 0, 0], "ydatasource", "y2");
for i = 1 : 30
y1 = sin (x + 0.1 * i);
y2 = cos (x + 0.1 * i);
refreshdata(gcf(), "caller");
pause(0.01);
endfor
The plot window is redrawn completely with every call to refreshdata.
The result is a very jerky, jolty diagram instead of a smooth animation.
The following example tries to do the same thing, avoiding the overhead of
the
refreshdata command. However, the result is only a moderate speed-up
leaving you
with basically the same situation
x = 0:0.1:10;
y1 = sin (x);
y2 = cos (x);
subplot ( 1, 2, 1) ;
plt1 = plot (x, y1 );
subplot ( 1, 2, 2) ;
plt2 = plot (x, y2, "color",[1, 0, 0]);
for i = 1 : 30
y1 = sin (x + 0.1 * i);
y2 = cos (x + 0.1 * i);
set ( plt1, "ydata", y1 );
set ( plt2, "ydata", y2 );
pause(0.01)
endfor
This behaviour is the same on ;-) and on linux.
Anything I got wrong or misunderstood ?
Could the gnuplot config file be in error or in need for modifications ?
Any idea, how a smooth animation could be achieved ?
adTHANKSvance,
Claus