|
29 | 29 | % 05/12/13: Bug fix to axes having different units. Thanks to Remington Reid for reporting
|
30 | 30 | % 21/04/15: Bug fix for exporting uipanels with legend/colorbar on HG1 (reported by Alvaro
|
31 | 31 | % on FEX page as a comment on 24-Apr-2014); standardized indentation & help section
|
| 32 | +% 22/04/15: Bug fix: legends and colorbars were not exported when exporting axes handle in HG2 |
32 | 33 |
|
33 | 34 | % Make sure we have an array of handles
|
34 | 35 | if ~all(ishandle(ah))
|
|
71 | 72 | set(ah(a), 'Tag', old_tag{a});
|
72 | 73 | end
|
73 | 74 | % Keep any legends and colorbars which overlap the subplots
|
74 |
| - lh = findall(fh, 'Type', 'axes', '-and', {'Tag', 'legend', '-or', 'Tag', 'Colorbar'}); |
| 75 | + % Note: in HG1 these are axes objects; in HG2 they are separate objects, therefore we |
| 76 | + % don't test for the type, only the tag (hopefully nobody but Matlab uses them!) |
| 77 | + lh = findall(fh, 'Tag', 'legend', '-or', 'Tag', 'Colorbar'); |
75 | 78 | nLeg = numel(lh);
|
76 | 79 | if nLeg > 0
|
77 | 80 | set([ah(:); lh(:)], 'Units', 'normalized');
|
|
84 | 87 | ax_pos = cell2mat(ax_pos(:));
|
85 | 88 | end
|
86 | 89 | ax_pos(:,3:4) = ax_pos(:,3:4) + ax_pos(:,1:2);
|
87 |
| - leg_pos = get(lh, 'OuterPosition'); |
| 90 | + try |
| 91 | + leg_pos = get(lh, 'OuterPosition'); |
| 92 | + catch |
| 93 | + leg_pos = get(lh, 'Position'); % No OuterPosition in HG2, only in HG1 |
| 94 | + end |
88 | 95 | if nLeg > 1;
|
89 | 96 | leg_pos = cell2mat(leg_pos);
|
90 | 97 | end
|
|
0 commit comments