How to increase the size of figures in Report Generator
6 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on MATLAB Report Generator Task Examples in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!