Resize uifigure to fit DIN A4 when exported

7 次查看(过去 30 天)
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

回答(1 个)

Divyanshu
Divyanshu 2023-11-16
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.
  1 个评论
Leon Berger
Leon Berger 2023-11-16
Hi, Thank you very much for that answer,
Unfortunatelly, this does not solve my Problem. Since, as i wrote, R2019b does not support nested tiledchartlayout-objects (introduced R2020a), I merged multiple tiledchartlayout-objects by inserting them into panels within a uifigure. Copying each axes of the tiledchartlayout-objects into one tiledchartlayout-object would not result into something pretty, since in R2019b also no settings for 'TileSpacing' was implemented. I would like to export my uifigure. Do you have any other tips?
Best regards.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by