Print figures with many subplots in A4 format or similar
69 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Gianluca Regina
il 16 Nov 2021
Risposto: Gianluca Regina
il 22 Nov 2021
Dear MatLab users,
I have several figures with 12 subplots (4 rows and 3 colums) which I want to print and/or save in a standard A4 format. The in-MatLab figures appear with squeezed axis, so I need at least an A4 format to get a good representation of the data. Now, I can use the user interface of the print preview and choose the properties I need, but I would like to code it, and there doesn't seem to be a "generate code" for the print preview options. I have read this thread (https://www.mathworks.com/matlabcentral/answers/593113-exporting-a-figure-including-multiple-subplots-into-high-resolution-pdf-or-svg) and tried several things, but I can't seem to find a good and consistent way to do it.
If I use the print command and its options, I lose the axis properties (I used xticklabels) and the labels are overlapped.
% e.g.
fig = gcf;
fig.PaperUnits = 'centimeters';
fig.PaperSize=[29.7 29.7];
fig.PaperPosition = [1 1 20 28];
fig.PaperType = 'a4' ;
fig.PaperOrientation = 'portrait' ;
print(fig,'test','-dpdf')
If I use the exportgraphics command I get good resolution, but it automatically uses an A3 format to fill the page.
exportgraphics(gcf,'test2.pdf','ContentType','vector' , 'Resolution',600)
Thus, what is the most consistent way to print figures with these type of issues?
2 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!