etna.analysis.plot_anomalies#

plot_anomalies(ts: TSDataset, anomaly_dict: Dict[str, List[Timestamp | int]], in_column: str = 'target', segments: List[str] | None = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5), start: Timestamp | int | str | None = None, end: Timestamp | int | str | None = None)[source]#

Plot a time series with indicated anomalies.

Parameters:
  • ts (TSDataset) – TSDataset of timeseries that was used for detect anomalies

  • anomaly_dict (Dict[str, List[Timestamp | int]]) – dictionary derived from anomaly detection function, e.g. get_anomalies_density()

  • in_column (str) – column to plot

  • segments (List[str] | None) – segments to plot

  • columns_num (int) – number of subplots columns

  • figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches

  • start (Timestamp | int | str | None) – start timestamp for plot

  • end (Timestamp | int | str | None) – end timestamp for plot

Raises:

ValueError: – Incorrect type of start or end is used according to ts.freq.