On 5/23/2013 7:19 AM, dpb wrote: > On 5/23/2013 5:42 AM, Stan wrote: >>> Don't understand what you need...gname() returns the handle of the text >> >> so try to read carefully what I wrote this will save your time and other. >> If the figure contains two plots: scatter and line can not handle the >> line. gname() handles scatter plot regardless of whether you use h1 or >> h2. Regards, >> Stan > > NO. Read what I wrote carefully (and more carefully check your own work).
Specifically, your example h2 is _not_ a line handle as SCATTER returns a vector of handles to the scatter objects it creates and there is no line object for it.
Oh, I just see there's a problem in the doc's for SCATTER -- it does say handles are line handles but that's an error. help text is correct in using scatter object.
>> h1 = plot(1:10, sin(1:10), 'o-'); >> hold on >> h2=scatter(10*rand(1,10),2*rand(1,10)-1,'x'); >> get(h2,'type') ans = hggroup >> get(h1,'type') ans = line >> hch=get(h2,'children'); >> for i=1:length(hch),get(hch(i),'type'),end ans = patch ans = patch ans = patch ans = patch ans = patch ans = patch ans = patch ans = patch ans = patch ans = patch
The above illustrates there is only the one line object in the figure of your example.
I didn't try gname() on the scatter object handle given the description so what happens....hmmm....
>> hh=gname(1:10, h2); >> hh hh = 187.0046 188.0046 189.0046 190.0046 >> get(hh(1),'type') ans = text >>
actually works to label the patches and ignores the line handle h1.
Looks like another place the doc could be updated/clarified some.
OBTW, this is R2012b here...
Again, looks like it functions as one would expect to me...what, again, specifically, is it that you're having a problem with or want some other behavior?