Resize uifigure to fit DIN A4 when exported

5 visualizzazioni (ultimi 30 giorni)
Leon Berger
Leon Berger il 2 Nov 2023
Commentato: Leon Berger il 16 Nov 2023
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

Risposte (1)

Divyanshu
Divyanshu il 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.
  1 Commento
Leon Berger
Leon Berger il 16 Nov 2023
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.

Accedi per commentare.

Categorie

Scopri di più su Develop uifigure-Based Apps in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by