- You are working with R2019b and you can use 'tiledlayout()' function to combine multiple axes together into a common figure. Refer the following documentation for more details: https://www.mathworks.com/help/releases/R2019b/matlab/ref/tiledlayout.html
- Below is a sample code for exporting the figure object as a pdf:
Resize uifigure to fit DIN A4 when exported
5 views (last 30 days)
Show older comments
Hi everyone,
I am currently working on a research paper. I have written some functions to create figures from large datasets. Since I have to use version r2019b, instead of nested TiledLayout-Objects I had to use uifigure and uigridlayout-objects to join different axes into one large uifigure. Now I cannot find any way to size the uifigure, so that when exporting (via hgexport() ) it automatically fits a DIN A4 page. Resizing the exported file is not an option, since for the paper I need to be consistent with the font sizes. In the R2019b Version, one also cannot change the Units of the uifigure to cm, for example. Do any of you have ideas for workarounds. Any answer ist very welcome. Thanks in advance.
LG Leon
0 Comments
Answers (1)
Divyanshu
on 16 Nov 2023
Hi Leon,
I understand that you want to export a figure which is a combination of multiple axes, as a pdf of A4 size. Refer the following pointers for better understanding:
f = figure;
tiledlayout(f,1,2);
nexttile;
x = linspace(1,10,2);
y = 2*x + 3;
plot(x,y);
nexttile;
y = 3*x+7;
plot(x,y);
set(f,'Units','Inches');
pos = get(f,'Position');
set(f,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[8, 10])
print(f,'myfigure','-dpdf','-r0','-fillpage')
Note that the values specified for 'PaperSize' in 'set' function should be modified according to the use-case which for you would be the dimensions of A4-size paper.
See Also
Categories
Find more on Develop uifigure-Based Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!