Adjust distance between snapshot and caption (report generator)
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Martin Tanke
am 22 Okt. 2018
Beantwortet: Rahul Singhal
am 20 Jun. 2019
My problem is based on the following example which is provided by MatLab:
import mlreportgen.report.*
surf(peaks);
rpt = Report('peaks');
chapter = Chapter();
chapter.Title = 'Figure Example';
add(rpt,chapter);
fig = Figure();
fig.Snapshot.Caption = '3-D shaded surface plot';
fig.Snapshot.Height = '5in';
add(rpt,fig);
delete(gcf);
rptview(rpt);
How can i adjust the distance between the caption and the figure. In my case the distance is to big. I want that the Caption is comes closer to the Figure.

Thanks in advance!
Best regards,
Martin
0 Kommentare
Akzeptierte Antwort
Rahul Singhal
am 20 Jun. 2019
Hi Martin,
You can customize the Figure reporter's template to adjust the distance between the generated figure and caption by updating the p.FigureImage style in the CSS.
Please refer to the below code:
% Create a custom Figure reporter template
customTemplate = mlreportgen.report.Figure.createTemplate('myTemplate','pdf');
% Unzip the custom template
unzipTemplate(customTemplate);
% In myTemplate\stylesheets\root.css, reduce the margin-bottom of p.FigureImage style
% p.FigureImage {
% margin-bottom: 1pt;
% }
% Zip back the custom template
zipTemplate(customTemplate);
% Use this custom template for the Figure reporter
fig = Figure();
fig.TemplateSrc = customTemplate;
Thanks,
Rahul
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Images, Figures, Axes, Equations, MATLAB Code, and MATLAB Variables finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!