time | Calls | line |
---|
| | 1 | function legKidsOut = expandLegendChildren(legKids)
|
| | 2 | %EXPANDLEGENDCHILDREN recursively goes through a list of graphics objects,
|
| | 3 | % expanding groups whose "LegendEntry" display property is set to
|
| | 4 | % "Children".
|
| | 5 |
|
| | 6 | % Copyright 2007-2014 The MathWorks, Inc.
|
| | 7 |
|
< 0.001 | 62 | 8 | legKidsOut = [];
|
< 0.001 | 62 | 9 | if isempty(legKids)
|
| | 10 | return
|
< 0.001 | 62 | 11 | end
|
| | 12 |
|
| | 13 | % Legend PlotChildren property expects objects of class primitive.Data
|
0.013 | 62 | 14 | legKidsOut = matlab.graphics.primitive.Data.empty;
|
| | 15 |
|
| | 16 | % only do the recurisve expanson (which is slow) if there is an hggroup
|
| | 17 | % present
|
0.043 | 62 | 18 | if any(arrayfun(@(x) isa(x,'matlab.graphics.primitive.Group'),legKids))
|
| | 19 | for i = 1:length(legKids)
|
| | 20 | hA = get(legKids(i),'Annotation');
|
| | 21 | if isobject(hA) && isvalid(hA)
|
| | 22 | hL = get(hA,'LegendInformation');
|
| | 23 | if isobject(hA) && isvalid(hA) && strcmpi(hL.IconDisplayStyle,'Children')
|
| | 24 | if isprop(handle(legKids(i)),'Children') && ...
|
| | 25 | ~isempty(get(legKids(i),'Children'))
|
| | 26 | legKidsOut = [legKidsOut;...
|
| | 27 | matlab.graphics.illustration.internal.expandLegendChildren(get(legKids(i),'Children'))];
|
| | 28 | else
|
| | 29 | legKidsOut = [legKidsOut;legKids(i)];
|
| | 30 | end
|
| | 31 | else
|
| | 32 | legKidsOut = [legKidsOut;legKids(i)];
|
| | 33 | end
|
| | 34 | else
|
| | 35 | legKidsOut = [legKidsOut;legKids(i)];
|
| | 36 | end
|
| | 37 | end
|
| | 38 | % make sure we haven't pulledin any non-legendable Group children
|
| | 39 | legKidsOut = legKidsOut(matlab.graphics.illustration.internal.islegendable(legKidsOut));
|
< 0.001 | 62 | 40 | else
|
| | 41 | % if there are no groups just return the input array
|
< 0.001 | 62 | 42 | legKidsOut = legKids;
|
< 0.001 | 62 | 43 | end
|