Resize uifigure to fit DIN A4 when exported

조회 수: 19 (최근 30일)
Leon Berger
Leon Berger 2023년 11월 2일
댓글: Leon Berger 2023년 11월 16일
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에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by