time | Calls | line |
---|
| | 1 | function ch=getLegendableChildren(ax,N)
|
| | 2 | %GET_LEGENDABLE_CHILDREN Gets the children for a legend
|
| | 3 | % CH=GET_LEGENDABLE_CHILDREN(AX,N) returns the
|
| | 4 | % legendable children for axes AX.
|
| | 5 | % N - is the threshold for the number of axes children to be returned.
|
| | 6 | % If N is not provided than all the axes children will be tested for being legendable
|
| | 7 |
|
| | 8 | % Copyright 2004-2019 The MathWorks, Inc.
|
| | 9 |
|
0.011 | 8 | 10 | legkids = allchild(ax);
|
| | 11 |
|
< 0.001 | 8 | 12 | if nargin > 1
|
| | 13 | legkids(N:end) = [];
|
< 0.001 | 8 | 14 | end
|
| | 15 |
|
| | 16 | % Take plotyy axes into account:
|
0.001 | 8 | 17 | if matlab.graphics.illustration.internal.isplotyyaxes(ax)
|
| | 18 | newAx = getappdata(ax,'graphicsPlotyyPeer');
|
| | 19 | newChil = get(newAx,'Children');
|
| | 20 | % The children of the axes of interest (passed in) should
|
| | 21 | % appear lower in the stack than those of its plotyy peer.
|
| | 22 | % The child stack gets flipud at the end of this function in
|
| | 23 | % order to return a list in creation order.
|
| | 24 | if ~isempty(newChil)
|
| | 25 | legkids = [newChil(:); legkids(:)];
|
| | 26 | else
|
| | 27 | legkids = legkids(:);
|
| | 28 | end
|
| | 29 |
|
< 0.001 | 8 | 30 | end
|
| | 31 |
|
< 0.001 | 8 | 32 | if isempty(legkids)
|
| | 33 | ch = matlab.graphics.primitive.Data.empty;
|
| | 34 | return
|
< 0.001 | 8 | 35 | end
|
| | 36 |
|
| | 37 | % exclude non-legendable objects
|
0.029 | 8 | 38 | legkids = legkids(matlab.graphics.illustration.internal.islegendable(legkids));
|
| | 39 |
|
| | 40 | % support for hggroup
|
0.012 | 8 | 41 | legkids = matlab.graphics.illustration.internal.expandLegendChildren(legkids);
|
| | 42 |
|
| | 43 | % We need to return a list of legendable children in creation order, but
|
| | 44 | % the axes 'Children' property returns a stack (reverse creation order).
|
| | 45 | % So we flip it.
|
0.007 | 8 | 46 | ch = flipud(legkids);
|
Other subfunctions in this file are not included in this listing.