Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: gname problem
Replies: 7   Last Post: May 23, 2013 9:01 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,219
Registered: 6/7/07
Re: gname problem
Posted: May 23, 2013 9:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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?

--







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.