Main Content

plot

Plot detected anomalies and anomaly scores in time series

Since R2025a

Description

plot(detector,data) plots the anomaly detection data in data that result from executing detect with the anomaly detection model detector.

plot plots two figures—one for the anomalies and the other for the anomaly score.

For an example of using plot as part of the detector development workflow, see Train and Test TCN Anomaly Detector.

plot(___,Name=Value) sets additional options using one or more name-value arguments.

Input Arguments

collapse all

Trained anomaly detector model, specified as a TcnDetector, DeepantDetector, UsadDetector, or VaelstmDetector object.

Single-member anomaly data to be plotted, specified as a table that is the output of detect.

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: plot(detectortcn,data,MiniBatchSize=64) plots a histogram of data for the TCN detector detectortcn and specifies a mini-batch size of 64 for detection.

All Detectors

expand all

Type of figure to plot, specified as "all", "anomaly", or "anomalyScores".

  • The "anomaly" plot type overlays the detected anomaly on the observed signal.

  • The anomalyScores plot type plots the anomaly scores against the threshold so that you can evaluate visually how effective the threshold is.

For an example of these plot types, see Train and Test TCN Anomaly Detector.

TCN. VAELSTM, and DeepAnt Detectors Only

expand all

Mini-batch size that is used in detect, specified as a positive integer scalar.

You must set this argument if detect uses a MiniBatchSize value of anything other than default size of 128.

TCN and DeepAnt Detectors Only

expand all

Execution environment that determines what hardware resources the software uses to run the network, specified as "auto", "gpu", or "cpu".

  • "auto" — Use the GPU if it is available, or, if not, the CPU.

  • "gpu" — Use the GPU.

  • "cpu" — Use the CPU.

Version History

Introduced in R2025a