plot_holidays

plot_holidays(ts: TSDataset, holidays: Union[str, pandas.core.frame.DataFrame], segments: Optional[List[str]] = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5))[source]

Plot holidays for segments.

Sequence of timestamps with one holiday is drawn as a colored region. Individual holiday is drawn like a colored point.

It is not possible to distinguish points plotted at one timestamp, but this case is considered rare. This the problem isn’t relevant for region drawing because they are partially transparent.

Parameters
  • ts (TSDataset) – TSDataset with timeseries data

  • holidays (Union[str, pandas.core.frame.DataFrame]) –

    there are several options:

    • if str, then this is code of the country in holidays library;

    • if DataFrame, then dataframe with holidays is expected to have timestamp index with holiday names columns.
      In a holiday column values 0 represent absence of holiday in that timestamp, 1 represent the presence.

  • 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