Many changes
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
function beautifyBERplot()
|
||||
% BEAUTIFYBERPLOT Enhances a BER plot for publication-quality figures.
|
||||
%
|
||||
% This function automatically adjusts the aesthetics of an existing plot.
|
||||
% It sets limits based on the data already plotted and modifies the
|
||||
% appearance for publication-ready figures.
|
||||
|
||||
% Set line properties for all current plot lines
|
||||
lines = findall(gca, 'Type', 'Line');
|
||||
@@ -11,10 +7,10 @@ function beautifyBERplot()
|
||||
num_markers = length(markers);
|
||||
|
||||
for i = 1:length(lines)
|
||||
lines(i).LineWidth = 1.5; % Set a thicker line width
|
||||
lines(i).LineStyle = '-'; % Solid lines for simplicity
|
||||
lines(i).LineWidth = 1.3; % Thicker line width
|
||||
%lines(i).LineStyle = '-'; % Solid lines for simplicity
|
||||
lines(i).Marker = markers{mod(i-1, num_markers) + 1}; % Assign markers cyclically
|
||||
lines(i).MarkerSize = 6; % Set marker size
|
||||
lines(i).MarkerSize = 4; % Marker size
|
||||
lines(i).MarkerFaceColor = 'auto'; % Use line color for marker face
|
||||
end
|
||||
|
||||
@@ -24,34 +20,16 @@ function beautifyBERplot()
|
||||
% Set figure background to white
|
||||
set(gcf, 'Color', 'w');
|
||||
|
||||
% Set axis labels with LaTeX
|
||||
xlabel('Bit Rate in Gbps', 'Interpreter', 'latex');
|
||||
ylabel('Bit Error Rate', 'Interpreter', 'latex');
|
||||
|
||||
% Determine x and y limits from the data in the plot
|
||||
x_data = [];
|
||||
y_data = [];
|
||||
for i = 1:length(lines)
|
||||
x_data = [x_data; lines(i).XData(:)]; %#ok<AGROW> % Append x data
|
||||
y_data = [y_data; lines(i).YData(:)]; %#ok<AGROW> % Append y data
|
||||
end
|
||||
x_min = min(x_data);
|
||||
x_max = max(x_data);
|
||||
y_min = 1e-4; % Ensure no negative or zero values for log scale
|
||||
y_max = 0.5;
|
||||
|
||||
% Adjust axis ranges
|
||||
xlim([x_min, x_max]);
|
||||
ylim([y_min, y_max]);
|
||||
|
||||
% Set logarithmic scale for y-axis
|
||||
set(gca, 'YScale', 'log');
|
||||
|
||||
% 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.
|
||||
% set(gca, 'YScale', 'log');
|
||||
|
||||
% Customize grid and box appearance
|
||||
set(gca, 'Box', 'on', 'LineWidth', 1.2); % Add a thicker border
|
||||
set(gca, 'Box', 'on', 'LineWidth', 0.8); % Thicker border
|
||||
grid on;
|
||||
grid minor;
|
||||
% grid minor;
|
||||
|
||||
% Adjust font size and style for better readability
|
||||
set(gca, 'FontSize', 12, 'FontName', 'Times New Roman');
|
||||
set(gca, 'FontSize', 10, 'FontName', 'Times New Roman');
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user