TS Seasonal Decompose Plot

In [8]:
%matplotlib inline
import matplotlib.pyplot as plt

fig = plt.figure()
fig.set_size_inches(10, 6)

ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(322)
ax3 = fig.add_subplot(324)
ax4 = fig.add_subplot(326)

from verticapy.datasets import load_airline_passengers
from verticapy.stats import seasonal_decompose

passengers = load_airline_passengers()
decomposition = seasonal_decompose(passengers, 
                                   "passengers", 
                                   "date",
                                   polynomial_order = 2,
                                   mult = True)
decomposition["passengers"].plot(ts = "date", ax = ax1, color = "#0073E7",)
decomposition["passengers_trend"].plot(ts = "date", ax = ax2, color = "#263133",)
ax2.set_xlabel("")
ax2.get_xaxis().set_ticks([])
decomposition["passengers_seasonal"].plot(ts = "date", ax = ax3, color = "#263133",)
ax3.set_xlabel("")
ax3.get_xaxis().set_ticks([])
decomposition["passengers_epsilon"].plot(ts = "date", ax = ax4, color = "#263133",)
Out[8]:
<AxesSubplot:xlabel='"date"', ylabel='"passengers_epsilon"'>