class_docstr: Base class for a forecast-based anomaly detector.
docstr: Plots the time series in matplotlib as a line graph, with points in the
  series overlaid as points color-coded to indicate their severity as
  anomalies. Optionally allows you to overlay the model's forecast & the
  model's uncertainty in its forecast (if applicable).
  
  :param time_series: the time series over whose timestamps we wish to make a forecast. Exactly one of
      ``time_series`` or ``time_stamps`` should be provided.
  :param time_series_prev: a time series immediately preceding ``time_series``. If given, we use it to initialize
      the forecaster's state. Otherwise, we assume that ``time_series`` immediately follows the training data.
  :param exog_data: A time series of exogenous variables. Exogenous variables are known a priori, and they are
      independent of the variable being forecasted. ``exog_data`` must include data for all of ``time_stamps``;
      if ``time_series_prev`` is given, it must include data for all of ``time_series_prev.time_stamps`` as well.
      Optional. Only supported for models which inherit from `ForecasterExogBase`.
  :param filter_scores: whether to filter the anomaly scores by the post-rule before plotting them.
  :param plot_forecast: Whether to plot the model's forecast, in addition to the anomaly scores.
  :param plot_forecast_uncertainty: whether to plot uncertainty estimates (the inter-quartile range) for forecast
      values. Not supported for all models.
  :param plot_time_series_prev: whether to plot ``time_series_prev`` (and the model's fit for it). Only used if
      ``time_series_prev`` is given.
  :param figsize: figure size in pixels
  :return: plotly figure
docstr_tok: ["Plots","the","time","series","in","matplotlib","as","a","line","graph",",","with","points","in","the","series","overlaid","as","points","color-coded","to","indicate","their","severity","as","anomalies",".","Optionally","allows","you","to","overlay","the","model","'s","forecast","&","the","model","'s","uncertainty","in","its","forecast","(","if","applicable",")",".",":","param","time_series",":","the","time","series","over","whose","timestamps","we","wish","to","make","a","forecast",".","Exactly","one","of","``","time_series","``","or","``","time_stamps","``","should","be","provided",".",":","param","time_series_prev",":","a","time","series","immediately","preceding","``","time_series","``",".","If","given",",","we","use","it","to","initialize","the","forecaster","'s","state",".","Otherwise",",","we","assume","that","``","time_series","``","immediately","follows","the","training","data",".",":","param","exog_data",":","A","time","series","of","exogenous","variables",".","Exogenous","variables","are","known","a","priori",",","and","they","are","independent","of","the","variable","being","forecasted",".","``","exog_data","``","must","include","data","for","all","of","``","time_stamps","``",";","if","``","time_series_prev","``","is","given",",","it","must","include","data","for","all","of","``","time_series_prev.time_stamps","``","as","well",".","Optional",".","Only","supported","for","models","which","inherit","from","`","ForecasterExogBase","`",".",":","param","filter_scores",":","whether","to","filter","the","anomaly","scores","by","the","post-rule","before","plotting","them",".",":","param","plot_forecast",":","Whether","to","plot","the","model","'s","forecast",",","in","addition","to","the","anomaly","scores",".",":","param","plot_forecast_uncertainty",":","whether","to","plot","uncertainty","estimates","(","the","inter-quartile","range",")","for","forecast","values",".","Not","supported","for","all","models",".",":","param","plot_time_series_prev",":","whether","to","plot","``","time_series_prev","``","(","and","the","model","'s","fit","for","it",")",".","Only","used","if","``","time_series_prev","``","is","given",".",":","param","figsize",":","figure","size","in","pixels",":","return",":","plotly","figure"]
code: def plot_anomaly_plotly(
      self,
      time_series: TimeSeries,
      time_series_prev: TimeSeries = None,
      exog_data: TimeSeries = None,
      *,
      filter_scores=True,
      plot_forecast=False,
      plot_forecast_uncertainty=False,
      plot_time_series_prev=False,
      figsize=(1000, 600),
  ):
      """
      Plots the time series in matplotlib as a line graph, with points in the
      series overlaid as points color-coded to indicate their severity as
      anomalies. Optionally allows you to overlay the model's forecast & the
      model's uncertainty in its forecast (if applicable).
  
      :param time_series: the time series over whose timestamps we wish to make a forecast. Exactly one of
          ``time_series`` or ``time_stamps`` should be provided.
      :param time_series_prev: a time series immediately preceding ``time_series``. If given, we use it to initialize
          the forecaster's state. Otherwise, we assume that ``time_series`` immediately follows the training data.
      :param exog_data: A time series of exogenous variables. Exogenous variables are known a priori, and they are
          independent of the variable being forecasted. ``exog_data`` must include data for all of ``time_stamps``;
          if ``time_series_prev`` is given, it must include data for all of ``time_series_prev.time_stamps`` as well.
          Optional. Only supported for models which inherit from `ForecasterExogBase`.
      :param filter_scores: whether to filter the anomaly scores by the post-rule before plotting them.
      :param plot_forecast: Whether to plot the model's forecast, in addition to the anomaly scores.
      :param plot_forecast_uncertainty: whether to plot uncertainty estimates (the inter-quartile range) for forecast
          values. Not supported for all models.
      :param plot_time_series_prev: whether to plot ``time_series_prev`` (and the model's fit for it). Only used if
          ``time_series_prev`` is given.
      :param figsize: figure size in pixels
      :return: plotly figure
      """
      metric_name = time_series.names[0]
      fig = self.get_figure(
          time_series=time_series,
          time_series_prev=time_series_prev,
          exog_data=exog_data,
          filter_scores=filter_scores,
          plot_forecast=plot_forecast,
          plot_anomaly=True,
          plot_forecast_uncertainty=plot_forecast_uncertainty,
          plot_time_series_prev=plot_time_series_prev,
      )
      title = f"{type(self).__name__}: Anomalies in {metric_name}"
      if plot_forecast:
          title += " (Forecast Overlaid)"
      return fig.plot_plotly(
          title=title, metric_name=metric_name, figsize=figsize
      )
  
imports: import copy
  import logging
  from typing import List, Optional, Tuple, Union
  import numpy
  import pandas
  from merlion.models.anomaly.base import DetectorBase
  from merlion.models.forecast.base import ForecasterBase
  from merlion.plot import Figure
  from merlion.utils import TimeSeries
  from merlion.utils.misc import AutodocABCMeta
label_desc: Use image node_id 10 for calling the ForecastingDetectorBase obj's underlying member method code with example usage: obj.plot_anomaly_plotly(time_series, time_series_prev, exog_data) and returns: fig