diff --git a/functions/utilities/exportFigureGUI.m b/functions/utilities/exportFigureGUI.m index 20690890178e0ac50f96fb3f769970f2ac0427f5..949c3f41600b1e976a8dc111a73465ef29eeb759 100644 --- a/functions/utilities/exportFigureGUI.m +++ b/functions/utilities/exportFigureGUI.m @@ -162,39 +162,45 @@ end % Retrieve axes from selected figure ax = findall(selectedFig, 'Type', 'axes'); - % Ensure valid axes exist - % if isempty(ax) - % ax = axes(selectedFig); - % plot(ax, rand(1, 10), rand(1, 10), 'o-'); % Sample plot - % end - % Delete any existing axes in the UI panel delete(findall(uiPanel, 'Type', 'axes')); % Copy the axes into the UI Panel newAx = copyobj(ax, uiPanel); set(newAx, 'Position', [0.1, 0.1, 0.8, 0.8]); % Adjust position in panel + hold(newAx, 'on'); % Apply user settings - % if addMarkersBox.Value - % hold(newAx, 'on'); - % plot(newAx, x, y, 'o', 'MarkerSize', 4); - % hold(newAx, 'off'); - % end - % if changeColorsBox.Value - % newAx.ColorOrder = lines(7); % Change color scheme - % end - % if gridBox.Value - % grid(newAx, 'on'); - % else - % grid(newAx, 'off'); - % end - % - % % Adjust aspect ratio if specified - % if WHratioField.Value > 0 - % daspect(previewAxes, [1 WHratioField.Value 1]); - % end + linesInPlot = findall(newAx, 'Type', 'line'); + if addMarkersBox.Value + for line = linesInPlot' + set(line, 'Marker', 'o', 'MarkerSize', 4); + end + end + if changeColorsBox.Value + set(newAx, 'ColorOrder', lines(7)); + end + if gridBox.Value + grid(newAx, 'on'); + else + grid(newAx, 'off'); + end + if changeLineStyleBox.Value + for line = linesInPlot' + set(line, 'LineStyle', '--'); + end + end + if satelliteMapColorsBox.Value + colormap(newAx, 'parula'); + end + if WHratioField.Value > 0 + daspect(newAx, [1 WHratioField.Value 1]); + end + + hold(newAx, 'off'); + + % Ensure preview updates on checkbox change addMarkersBox.ValueChangedFcn = @(src, event) updatePreview(); changeColorsBox.ValueChangedFcn = @(src, event) updatePreview(); gridBox.ValueChangedFcn = @(src, event) updatePreview(); @@ -269,14 +275,14 @@ submitButton = uibutton(fig, 'Text', 'Export Figure', ... end function figHandles = findFigures(fig) - figHandles = findall(0, 'Type', 'figure'); - figHandles(figHandles == fig) = []; % Exclude GUI figure +figHandles = findall(0, 'Type', 'figure'); +figHandles(figHandles == fig) = []; % Exclude GUI figure end function figNames = getFigureNames(figHandles) - if isempty(figHandles) - figNames = {'No figures open'}; - else - figNames = arrayfun(@(f) sprintf('Figure %d', f.Number), figHandles, 'UniformOutput', false); - end +if isempty(figHandles) + figNames = {'No figures open'}; +else + figNames = arrayfun(@(f) sprintf('Figure %d', f.Number), figHandles, 'UniformOutput', false); +end end \ No newline at end of file