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.
fig.PaperUnits = 'centimeters';
fig.PaperPosition = [1 1 20 28];
fig.PaperOrientation = 'portrait' ;
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?