How to increase the size of figures in Report Generator

8 Ansichten (letzte 30 Tage)
Blue
Blue am 14 Okt. 2021
Hello,
I want to have 2 figures per page in my report but I cant figure out how to maximize the size of my figures so that I am left with an 1 inch margin around each page. Best I could manage is below.
Any ideas ?
Thank you,
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('test', 'pdf');
open(rpt)
for i = 1:3
x = [1 2 3 4];
y = [2 4 6 8];
% raw scatter plot
figure();
scatter(x, y);
title('raw data')
xlabel('x axis');
ylabel('y axis');
set(gcf, 'Position', [200 200 600 450])
% Format figure for document
figure = Figure();
img = Image(getSnapshotImage(figure, rpt));
img.Width = '5.2in';
img.Height = [];
halign = mlreportgen.dom.HAlign('center');
img.Style = [img.Style(:)' {halign}];
delete(gcf);
% Add figure to document
add(rpt, img);
% Log data scatter plot with outliers
figure();
scatter(log(x), log(y));
title('log data')
xlabel('x axis');
ylabel('y axis');
set(gcf, 'Position', [200 200 600 450])
% Format figure for document
figure = Figure();
img = Image(getSnapshotImage(figure, rpt));
img.Width = '5.2in';
img.Height = [];
halign = mlreportgen.dom.HAlign('center');
img.Style = [img.Style(:)' {halign}];
delete(gcf);
% Add figure to document (2 figures per page)
add(rpt, img);
end

Antworten (0)

Kategorien

Mehr zu MATLAB Report Generator Task Examples finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by