[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about ordering of visible/hidden children in graphics objec
From: |
Ben Abbott |
Subject: |
Re: question about ordering of visible/hidden children in graphics objects (was: rearranging 'children' in a graphics handle) |
Date: |
Wed, 10 Feb 2010 19:40:11 -0500 |
On Feb 10, 2010, at 7:17 PM, John W. Eaton wrote:
> On 10-Feb-2010, Ben Abbott wrote:
>
> | On Feb 10, 2010, at 1:56 PM, John W. Eaton wrote:
> |
> | > On 10-Feb-2010, Ben Abbott wrote:
> | >
> | > | Its not clear to me if the discussion is about hidden handles or
> | > | hidden objects.
> | >
> | > Hidden handles. For example, what does Matlab do for the following?
> | >
> | > h1 = line (rand (3, 1), rand (3, 1))
> | > h2 = line (rand (3, 1), rand (3, 1))
> | > h3 = line (rand (3, 1), rand (3, 1))
> | > set (0, 'showhiddenhandles', 'on')
> | > get (gca (), 'children') ## expect [h3; h2; h1; hidden...]
> | > set (0, 'showhiddenhandles', 'off')
> | > set (h2, 'handlevisibility', 'off');
> | > kids = get (gca (), 'children') ## should only get [h3; h1]
> | > set (0, 'showhiddenhandles', 'on')
> | > get (gca (), 'children') ## expect [h3; h2; h1; other
> hidden...]
> | > set (0, 'showhiddenhandles', 'off')
> | > set (gca (), 'children', flipud (kids))
> | > get (gca (), 'children') ## expect [h1; h3]
> | > set (0, 'showhiddenhandles', 'on')
> | > get (gca (), 'children')
> | >
> | > Should the result of the last command above be
> | >
> | > [h1; h3; h2; other hidden...]
> | >
> | > or
> | >
> | > [h1; h2; h3; other hidden...]
> | >
> | > Currently, Octave returns the first list above.
> | >
> | > BTW,
> | >
> | > findall (gca ())
> | >
> | > does not seem to be equivalent to
> | >
> | > set (0, 'showhiddenhandles', 'on')
> | > get (gca (), 'children')
> | >
> | > With findall, the handles appear to be sorted. Is that required for
> | > compatibility with Matlab?
> | >
> | > What does Matlab do? The order of the handles might matter in how
> | > things are displayed, so we probably need to be compatible with the
> | > Matlab behavior.
> | >
> | > jwe
> |
> | I've attached the results.
> |
> | The portion below ...
> |
> | > get (gca (), 'children') ## expect [h3; h2; h1; other
> hidden...]
> |
> | was ordered as [other hidden handles; h3; h2; h1]
> |
> | The last part was ordered as ... [other hidden handles; h2; h1; h3]
>
> Then I think this part of our current implementation is OK, except
> that the order of the handles is apparently reversed. Does that
> matter? I thought we already switched the order of children once for
> Matlab compatibility. Did we get the ordering wrong?
>
> Also, what about the order of the hidden objects, and what are they?
> xlabel, ylabel, zlabel and what else?
In the event, the order turns out to be important ...
h = get (gca (), 'children')
h =
177
176
175
174
172
0.0012207
173
get (h, 'type')
ans =
'text'
'text'
'text'
'text'
'line'
'line'
'line'
>> get(gca,'xlabel')
ans =
174
>> get(gca,'ylabel')
ans =
175
>> get(gca,'zlabel')
ans =
176
>> get(gca,'title')
ans =
177
So the final order is [title, zlabel, ylabel, xlabel,, h2, h1, h3]
Ben