mlreportgen.report.Axes Class
Namespace: mlreportgen.report
Description
Use objects of the mlreportgen.report.Axes
class to report on axes found in
a MATLAB® figure.
The mlreportgen.report.Axes
class is a handle
class.
Creation
Description
creates an Axes object with default property values. You must specify the axes handle to
report by setting the Source
property. Use other properties to specify report options.axes
= mlreportgen.report.Axes
Note
The figure containing the axes must remain open until you add the axes reporter to a report.
creates a reporter that adds the axes specified by axes
= mlreportgen.report.Axes(source
)source
and sets the
Source
property to source
.
sets properties by using name-value arguments. Specify multiple name-value arguments in
any order.axes
= mlreportgen.report.Axes(Name
=Value
)
Properties
Source
— Axes image source
axes handle
Axes image source, specified as an axes handle.
Snapshot
— Snapshot reporter
mlreportgen.report.FormalImage
object
Snapshot reporter, specified as an mlreportgen.report.FormalImage
object. Use the properties of the
FormalImage
object to specify the caption for the snapshot image
or to further customize the size of the image.
Note
The reporter initializes the Snapshot
property. Do not reset
this property.
SnapshotFormat
— Snapshot image format
"svg"
(default) | "emf"
| "gif"
| "jpg"
| "pdf"
| "png"
| "tif"
Snapshot image format, specified as "svg"
, "emf"
, "gif"
,
"jpg"
, "pdf"
, "png"
, or
"tif"
. The table lists which image formats are supported for
which report types.
Image Format | File Extension | Supported in HTML | Supported in Word | Supported in PDF |
---|---|---|---|---|
Windows® metafile | .emf | No | Yes | No |
Graphics Interchange Format | .gif | Yes | Yes | Yes |
JPEG image | .jpg | Yes | Yes | Yes |
.pdf | No | No | Yes | |
Portable Network Graphics | .png | Yes | Yes | Yes |
Scalable Vector Graphics | .svg | Yes | Yes | Yes |
TIFF image | .tif | No | Yes | Yes |
Data Types: char
| string
Scaling
— Scaling options for snapshot image
"auto"
(default) | "custom"
| "none"
Scaling options for the snapshot image, specified as "auto"
,
"custom"
, or "none"
. This property controls
the size of the snapshot image in the image file. Supported scaling options are:
"auto"
— For PDF or Word (DOCX) output, use this option to scale the snapshot image to fit the current page layout while maintaining its aspect ratio. First, the reporter scales the snapshot image to the page width. If the image height exceeds the page height, the reporter scales the image down again. This additional scaling ensures that the image fits the current page with an extra one inch spacing. Scaling does not apply to HTML output."custom"
— Use this option to scale the snapshot image based on the values of theHeight
andWidth
properties."none"
— Do not perform scaling
For a PDF image, the size limit is 10000px for width and height. For all other image types, the size limit is the screen size.
Note
The "auto"
and "custom"
options use the MATLAB
print
command to resize the figure. If the figure is too large to fit
in the specified space, the print
command crops the snapshot image. To
avoid cropping, set the Scaling property to "none" and use the reporter specified by the
Snapshot
property to size the image. Because the reporter reduces
the size of the text with the rest of the image, fine details may not be legible unless you
zoom the image. See Resize Figure Snapshot Image.
Note
A java.lang.OutOfMemoryError
can occur when the
Scaling
is set to "custom"
, and
Height
and Width
properties are set to large
values. To avoid or solve this error, use smaller Height
and
Width
property values.
Data Types: char
| string
Height
— Height of snapshot image
"6in"
(default) | character vector | string scalar
Height of the snapshot image, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement. For example,
"2in"
specifies two inches. The default snapshot is 6 inches.
Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the height limit is 10000 pixels. For all other image types, the height limit is the screen height.
Example: "2in"
Data Types: char
| string
Width
— Width of snapshot image
"6.5in"
(default) | character vector | string scalar
Width of the snapshot image, specified as a character vector or string scalar that
consists of a number followed by an abbreviation for a unit of measurement. For example,
"2in"
specifies two inches. The default snapshot width is 6.5
inches. Valid abbreviations are:
"px"
— pixels"cm"
— centimeters"in"
— inches"mm"
— millimeters"pc"
— picas"pt"
— points
For PDF images, the width limit is 10000 pixels. For all other image types, the width limit is the screen width.
Example: "2in"
Data Types: char
| string
PreserveBackgroundColor
— Whether to preserve background color
false
or 0
(default) | true
or 1
Whether to preserve background color in the snapshot, specified as a numeric or
logical 1 (true
) or 0 (false
). If
PreserveBackgroundColor
is true
, the
background color of the snapshot is the same as the background color of the snapshot
source. If PreserveBackgroundColor
is false
, the
background color of the snapshot is white.
Data Types: logical
TemplateSrc
— Source of template for this reporter
character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified in one of these ways:
Character vector or string scalar that specifies the path of the file that contains the template for this reporter
Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter
Document Object Model (DOM) document or document part whose template is used for this reporter or whose template library contains the template for this reporter
The specified template must be the same type as the report to which you
append this reporter. For example, for a Microsoft® Word report, TemplateSrc
must be a Word reporter template.
If the TemplateSrc
property is empty, this reporter uses the
default reporter template for the output type of the report.
TemplateName
— Name of template for this reporter
character vector | string scalar
Name of the template for this reporter, specified as a character vector or string scalar.
The template for this reporter must be in the template library of the template specified by
the TemplateSrc
property of this reporter.
Data Types: char
| string
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID, or an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value converts to a LinkTarget
object. The link target immediately
precedes the content of this reporter in the output report.
Methods
Public Methods
getSnapshotImage | Get axes image path |
mlreportgen.report.Axes.createTemplate | Create axes reporter template |
mlreportgen.report.Axes.customizeReporter | Create class derived from axes reporter class |
mlreportgen.report.Axes.getClassFolder | Get location of folder containing mlreportgen.report.Axes class
definition file |
copy | Create copy of reporter object and make deep copies of certain property values |
getImpl | Get implementation of reporter |
Examples
Add an Axes Image to Report
This example shows how to add an axes image to a report and set the axes image caption and dimensions.
import mlreportgen.report.*
Create a PDF report and chapter.
rpt = Report("Add Axis Figure", "pdf"); chapter = Chapter("Axes");
Create data and a set of axes for the plot.
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 by using mlreportgen.report.Axes
.
axesRpt = Axes(ax);
Use the custom scaling options to set the height and width of the image to be four inches.
axesRpt.Scaling = "custom"; axesRpt.Height = "4in"; axesRpt.Width = "4in";
Add the axes reporter to the chapter and the chapter to the report.
append(chapter,axesRpt); add(rpt,chapter);
Close the report and view it.
close(rpt); rptview(rpt);
Version History
Introduced in R2021bR2024b: Removal of BMP for image output
Report Generator no longer supports BMP (bitmap) as an output image format. This affects
snapshots, images from files, and watermarks in both the Report Explorer and the Report,
DOM, and PPT APIs. See print
for more information.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)