mlreportgen.report.Axes class
Package: 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
Snapshot
— Axes image properties
mlreportgen.report.FormalImage
object
Properties for the axes image, specified as an
mlreportgen.report.FormalImage
object. Use the properties of the
FormalImage
object to specify the size of a snapshot if you cannot
use Scaling, Height and Width properties without cropping the image.
Note
The axes reporter initializes the Snapshot
property. Do not
reset this property.
Source
— Axes image source
axes handle
Axes image source, specified as an axes handle.
SnapshotFormat
— Snapshot image format
'svg'
(default) | 'bmp'
| 'jpg'
| 'png'
| 'emf'
| 'tif'
| 'pdf'
Snapshot image format, specified as a character vector or string scalar. Supported formats are:
'svg'
— Scalable Vector Graphics.'bmp'
— Bitmap image.'jpg'
— JPEG image.'png'
— PNG image.'emf'
— Enhanced metafile. This format is supported only in DOCX output on Windows® platforms.'tif'
— Tag Image File format. This format is not supported in HTML reports.'pdf'
— PDF image. This format is supported only in PDF reports.
Scaling
— Scaling options for axes image
'auto'
(default) | 'custom'
| 'none'
Scaling options for the axes image, specified as 'auto'
,
'custom'
, or 'none'
.
'auto'
— For PDF or Word reports, this setting scales the axes image to fit the current page layout while maintaining its aspect ratio. First, the axes image scales to the page width. If the image height exceeds the page height, the image scales down again. This additional scaling ensures that the image fits the current page with an extra one inch spacing. This setting does not apply to HTML reports.'custom'
— This setting scales the axes image based on the values of theHeight
andWidth
properties.'none'
— The image is not scaled.
Note
The 'auto'
and 'custom'
options use the
MATLAB
print
command to resize the figure. If the figure is too large to
fit legibly in the specified space, the print
command crops the
snapshot image. To avoid cropping, you can set Scaling
to
'none'
and use the reporter specified by the
Snapshot
property to size the axes image. Because this reporter
reduces the size of the text with the rest of the image, a user might need to zoom the
image to discern fine detail. See Resize Figure Snapshot Image.
Height
— Height of snapshot image
character vector | string scalar
Height of 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. Valid abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Example: '2in'
Width
— Width of snapshot image
character vector | string scalar
Width of 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. Valid abbreviations are:
px
— pixels (default)cm
— centimetersin
— inchesmm
— millimeterspc
— picaspt
— points
Example: '3in'
PreserveBackgroundColor
— Preserve axes background color
false (default) | true
Preserve the axes background color in the snapshot, specified as
true
or false
. If
PreserveBackgroundColor
is true
, the
background color of the snapshot is the same as the background color of the axes. If
PreserveBackgroundColor
is false
, the
background color of the axes image is white.
TemplateSrc
— Source of template for this reporter
[]
(default) | character vector | string scalar | reporter or report | DOM document or document part
Source of the template for this reporter, specified as one of these options:
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
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 this
reporter is appended. 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 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 source
(TemplateSrc
) for this reporter.
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 as an mlreportgen.dom.LinkTarget
object. A character vector or string scalar
value is converted 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 R2021b
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
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)