help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing xdata in stem plot


From: Ben Abbott
Subject: Re: changing xdata in stem plot
Date: Wed, 12 Jun 2013 00:21:51 +0000 (GMT)

On Jun 11, 2013, at 11:52 AM, pvpage <address@hidden> wrote:

Unlike plot(), when I want to change xdata and ydata in a stem (or stairs), I
have to issue set(hs,'xdata'...) two times.

A clumsy solution is the try..catch statement. The following snippet works
fine in Octave 3.6.4 VS2010 with fltk.

hf= figure;
N = 20;
x = 0:(N-1);
y = rand(1,N);
hs=stem(x(1),y(1));
% hs=stairs(x(1),y(1));
% hs=plot(x(1),y(1));
set(gca(), 'xlim',[1,N], 'ylim',[0,1]);
for k=2:N
pause(0.2);
try
set(hs, 'xdata',x(1:k), 'ydata', y(1:k));
catch
set(hs, 'xdata',x(1:k), 'ydata', y(1:k));
printf("catch at k= %d\n", k);
end_try_catch
drawnow();
endfor

I see that stem has type=hggroup with 2 children, while plot has type=line.
So I figured that the problem arises because the command set(hs,'xdata'...)
is actually fixing one child at time. Is that right?

Anyway I have to say that it would be more convenient if a single set()
command took care of these details automatically. Don't you think?

I filed a bug report and cc'd you.

https://savannah.gnu.org/bugs/index.php?39234

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]