Skip to content
Snippets Groups Projects
Commit acc64c9a authored by Giulia Ghirardini's avatar Giulia Ghirardini Committed by Marco Luigi Gaibotti
Browse files

[esf] Fixed a bug for subplots in multiple tab plots

parent de7a160f
No related branches found
No related tags found
1 merge request!15Export standardized figure
...@@ -67,9 +67,55 @@ switch check(1) ...@@ -67,9 +67,55 @@ switch check(1)
return; return;
case 1 case 1
if box.satelliteMapColors.Value, box.satelliteMapColors.Value = false; end if box.satelliteMapColors.Value, box.satelliteMapColors.Value = false; end
if isa(obj.Children(1), 'matlab.ui.container.TabGroup')
if box.satelliteMapColors.Value, box.satelliteMapColors.Value = false; end
numTabs = numel(obj.Children(1).Children); % Get number of tabs
originalFigNum = obj.Number; % Get the original figure number
% for i = 1:numTabs
% newFigName = sprintf('Figure %d - Tab %d', originalFigNum, i);
% newFig = figure('Name', newFigName, 'NumberTitle', 'off');
%
% axesList = obj.Children(1).Children(i).Children;
% numAxes = numel(axesList);
%
% axesList = flipud(axesList); % Maintain visual order
%
% rows = ceil(sqrt(numAxes));
% cols = ceil(numAxes / rows);
%
% for j = 1:numAxes
% dummyAx = subplot(rows, cols, j, 'Parent', newFig); % Get subplot position
% subplotPos = get(dummyAx, 'Position');
%
% newAx = copyobj(axesList(j), newFig); % Copy into figure
% set(newAx, 'Position', subplotPos); % Apply subplot position
%
% delete(dummyAx); % Remove placeholder subplot
% end
% end
% a subplot of 2 elements can be organized into 2 elements in the same row,
% so 2 columns (vertical aspect), or the 2 elements can be organized into 2
% different rows but in the same column (horizontal aspect).
for i = 1:numTabs
newFigName = sprintf('Figure %d - Tab %d', originalFigNum, i);
newFig = figure('Name', newFigName, 'NumberTitle', 'off');
axesList = obj.Children(1).Children(i).Children;
axesList = flipud(axesList); % To preserve visual order
newAx = obj.Children; for j = 1:numel(axesList)
hold(newAx, 'on'); originalPos = get(axesList(j), 'Position'); % Normalized position
newAx = copyobj(axesList(j), newFig); % Copy to figure
set(newAx, 'Position', originalPos); % Apply original layout
end
end
delete(obj);
else
newAx = obj.Children;
hold(newAx, 'on');
end
case 2 case 2
if isa(obj.Children(1), 'matlab.ui.container.TabGroup') if isa(obj.Children(1), 'matlab.ui.container.TabGroup')
if box.satelliteMapColors.Value, box.satelliteMapColors.Value = false; end if box.satelliteMapColors.Value, box.satelliteMapColors.Value = false; end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment