How to increase the size of figures in Report Generator

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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator Task Examples 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by