seasonal_plot

seasonal_plot(ts: TSDataset, freq: Optional[str] = None, cycle: Union[Literal['hour'], Literal['day'], Literal['week'], Literal['month'], Literal['quarter'], Literal['year'], int] = 'year', alignment: Union[Literal['first'], Literal['last']] = 'last', aggregation: Union[Literal['sum'], Literal['mean']] = 'sum', in_column: str = 'target', plot_params: Optional[Dict[str, Any]] = None, cmap: str = 'plasma', segments: Optional[List[str]] = 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 (Optional[str]) –

    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 (Union[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 (Union[Literal['first'], typing.Literal['last']]) – how to align dataframe in case of integer cycle (see SeasonalPlotAlignment)

  • aggregation (Union[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 (Optional[Dict[str, Any]]) – dictionary with parameters for plotting, matplotlib.axes.Axes.plot() is used

  • segments (Optional[List[str]]) – 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