seasonal_plot#

seasonal_plot(ts: TSDataset, freq: str | None = None, cycle: Literal['hour'] | Literal['day'] | Literal['week'] | Literal['month'] | Literal['quarter'] | Literal['year'] | int = 'year', alignment: Literal['first'] | Literal['last'] = 'last', aggregation: Literal['sum'] | Literal['mean'] = 'sum', in_column: str = 'target', plot_params: Dict[str, Any] | None = None, cmap: str = 'plasma', segments: List[str] | None = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5))[source]#

Plot each season on one canvas for each segment.

Parameters:
  • ts (TSDataset) – dataset with timeseries data

  • freq (str | None) –

    frequency to analyze seasons:

    • if isn’t set, the frequency of ts will be used;

    • if set, resampling will be made using aggregation parameter. If given frequency is too low, then the frequency of ts will be used.

  • cycle (Literal['hour'] | ~typing.Literal['day'] | ~typing.Literal['week'] | ~typing.Literal['month'] | ~typing.Literal['quarter'] | ~typing.Literal['year'] | int) – period of seasonality to capture (see SeasonalPlotCycle)

  • alignment (Literal['first'] | ~typing.Literal['last']) – how to align dataframe in case of integer cycle (see SeasonalPlotAlignment)

  • aggregation (Literal['sum'] | ~typing.Literal['mean']) – how to aggregate values during resampling (see SeasonalPlotAggregation)

  • in_column (str) – column to use

  • cmap (str) – name of colormap for plotting different cycles (see Choosing Colormaps in Matplotlib)

  • plot_params (Dict[str, Any] | None) – dictionary with parameters for plotting, matplotlib.axes.Axes.plot() is used

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

  • columns_num (int) – number of columns in subplots

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