Matlab figures of same size still appear different in a LaTex document
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Wissem-Eddine KHATLA
el 4 de Abr. de 2024
Comentada: Wissem-Eddine KHATLA
el 7 de Abr. de 2024
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 comentarios
Jeff Miller
el 5 de Abr. de 2024
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).
Respuestas (1)
Ayush Anand
el 4 de Abr. de 2024
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!
1 comentario
Ver también
Categorías
Más información sobre Printing and Saving en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!