etna.analysis.seasonal_plot#
- seasonal_plot(ts: TSDataset, freq: str | None | Literal['not_given'] = 'not_given', 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 | Literal['not_given']) –
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 ofts
will be used. This option isn’t supported for data with integer timestamp.
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 usedcolumns_num (int) – number of columns in subplots
figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches
- Raises:
ValueError: – Resampling isn’t supported for data with integer timestamp
ValueError: – Setting non-integer cycle isn’t supported for data with integer timestamp
ValueError: – Value None for freq parameter isn’t supported for data with datetime timestamp