Files
imdd_silas/Functions/beautifyBERplot.m
Silas Oettinghaus 09f345aa91 ML_MLSE (before testing in depth)
minor changes here and there
2025-10-31 10:36:13 +01:00

44 lines
1.5 KiB
Matlab

function beautifyBERplot(options)
arguments
options.logscale = 1
end
% BEAUTIFYBERPLOT Enhances a BER plot for publication-quality figures.
% Set line properties for all current plot lines
lines = findall(gca, 'Type', 'Line');
markers = {'o', 's', 'd', '^', 'v', '>', '<', 'p', 'h'}; % Define marker styles
num_markers = length(markers);
for i = 1:length(lines)
lines(i).LineWidth = 1.3; % Thicker line width
lines(i).LineStyle = '-'; % Solid lines for simplicity
if string(lines(i).Marker) == "none"
lines(i).Marker = markers{mod(i-1, num_markers) + 1}; % Assign markers cyclically
end
lines(i).MarkerSize = 7; % Marker size
lines(i).MarkerFaceColor = lines(i).Color; % Use line color for marker face
lines(i).MarkerEdgeColor = 'white';
end
% Change all text interpreters to LaTeX
set(findall(gca, '-property', 'Interpreter'), 'Interpreter', 'latex');
% Set figure background to white
set(gcf, 'Color', 'w');
% Set logarithmic scale for y-axis, but only if it makes sense.
% If this is not always desired, you could condition this on the presence of lines or data.
if options.logscale
set(gca, 'YScale', 'log');
end
% Customize grid and box appearance
set(gca, 'Box', 'on', 'LineWidth', 0.8); % Thicker border
grid on;
% grid minor;
% Adjust font size and style for better readability
set(gca, 'FontSize', 10, 'FontName', 'Times New Roman');
end