Matlab figures of same size still appear different in a LaTex document
22 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to import 2 Matlab figures as EPS files to put in a LateX document side by side. I have checked the size of the figures : it is the same. However, in my Latex PDF, I have a small vertical shift between the 2 (image below), and I don't understand if it is a LateX problem or a Matlab one.
Assuming, it is a possible Matlab error, I am asking my question here but feel free to say that it could be related to Latex so i can delete my post.
Thank you in advance for your help,
Best regards,
2 个评论
Jeff Miller
2024-4-5
If it is an option, it might be more convenient to include both panels in a single MATLAB figure using tiledlayout or subplot. That way you only have one eps or pdf file to include in your LaTex document, and the alignment between panels should be managed properly by MATLAB (i.e., I've never had alignment problems with multi-panel figures).
回答(1 个)
Ayush Anand
2024-4-4
Hi,
The error could be arising in either MATLAB or Latex. You would have to check the vertical alignment in minipage or any environment you are using to align the figures on the Latex side.
On the MATLAB side, you can double check if the actual figure doesn't have any additional whitespaces on the sides. You can adjust the figure's properties before exporting to minimize any unnecessary margins through the following lines of code:
fig = gcf; % Get figure handle
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];
print(fig, 'filename.eps', '-depsc');
You can refer to the following MATLAB answer for more insights on this:
Hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!