Main Content

getSnapshotImage

Class: mlreportgen.report.Axes
Namespace: mlreportgen.report

Get axes image path

Since R2021b

Syntax

axesPath = mlreportgen.report.Axes.getSnapshotImage(axesReporter,report)

Description

axesPath = mlreportgen.report.Axes.getSnapshotImage(axesReporter,report) creates an image of the axes specified by axesReporter in the specified report and returns a path to a file containing the image. Use this method to customize the layout of axes in your report.

Input Arguments

expand all

Axes reporter, specified as an mlreportgen.report.Axes object.

Report, specified as a report object. To create the report input, use mlreportgen.report.Report.

Output Arguments

expand all

Path of the axes image, returned as string.

Examples

expand all

import mlreportgen.report.*
import mlreportgen.dom.*
 
% Create a PDF report
rpt = Report("Axes Image Size","pdf");

% Create an axes object
ax = axes(Position=[0.1 0.1 0.7 0.7]);
x1 = linspace(0,10,100);
y1 = sin(x1);
plot(ax,x1,y1);

% Create an axes reporter object for 'ax'
axesRpt = Axes(ax);
% Access the image path by using getSnapshotImage
axesImg = Image(getSnapshotImage(axesRpt,rpt));
axesImg.Width = "3in";
axesImg.Height = "3in";

append(rpt,axesImg)
close(rpt);
rptview(rpt);

Version History

Introduced in R2021b