Figures resolution fadw away in PDF file

4 views (last 30 days)
Hi,
I have 120 separate plots after long simulation, I save those in figure.jpg format. When I combine 10 of those figues in a one-plot using tiled layout and save in eps formate to use in Latex overleaf, I see the legend and taxt annotation are fade away when zooming out to read the plot. My separate original plot contains legend as usual and text annotation to show estimated parameters. Later I saved the original figues in eps format and try to combine these into one plot to save in eps format again. but my code gives error. here is code block :
%%%%%%%%%%%%%%%%%%%%%%%%
folder_dir ='C:\Users\n11779373\OneDrive - Queensland University of Technology\Desktop\Candiddature\Erfan_Figure';
% Number of images to load
num_images = 7;
% Create a tiled layout for displaying the images
t7 = tiledlayout(3, 3, 'TileSpacing', 'none', 'Padding', 'none'); % Adjust rows and columns as needed
% Loop through all images and display them
for i = 1:num_images
% Construct the image file name dynamically
image_file = fullfile(folder_dir, sprintf('fit%d.eps', i));
% Check if the file exists
if isfile(image_file)
%The code line is for images in eps format.
nexttile
% Load and display EPS using 'copygraphics'
fig = figure;
copyfile(image_file, fullfile(folder_dir, 'temp.eps')); % Copy if needed
set(gca, 'Visible', 'off'); % Turn off the axis
% print(fig, '-depsc', '-r900', fullfile(folder_dir, 'temp_combined_fit_plot.eps'));
close(fig);
axis off; % Turn off axis for a clean appearance
% Add a label (A), (B), etc., at the top-left corner of each image
%label = sprintf('(%s)', char('A' + i - 1)); % Generate label (A), (B), etc.
%text(10, 10, label, 'Color', 'black', 'FontSize', 8, 'FontWeight', 'bold'); % Add label
else
warning('File not found: %s', image_file);
end
end
% Adjust figure size (optional)
fig_height = 270;
fig_width = 550;
textsize = 12;
set(gca, 'FontSize', textsize, 'TickLabelInterpreter', 'latex');
drawnow;
set(gcf, 'Position', [100, 50, fig_width, fig_height * (1 + sqrt(5)) / 2]);
set(gcf, 'Renderer', 'painters'); % Ensures high-quality text and lines
% Save the figure with improved resolution
print(gcf, '-depsc', '-r900', fullfile(folder_dir, 'combinedFitplot1DT.eps'));
Can any one help me to fix the problem.
Thanks in advance.

Accepted Answer

Thorsten
Thorsten on 11 Apr 2025
It is not possible to read eps in Matlab as an image. I would rewrite your code to store the simulation results in 120 mat files and then read 10 of these matfiles to produce the desired output.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!