Welcome to SO! par()
won't work because plot.decomposed.ts()
(which you implicitly call when calling plot()
) isn't designed to work that way. The most straightforward alternative is to use autoplot()
from the forecast
package to generate decomposition plots and combine them using patchwork.
Here is an example.
m1 = decompose(co2)
m2 = decompose(AirPassengers)
m3 = decompose(UKgas)
p1 = autoplot(m1)
p2 = autoplot(m2)
p3 = autoplot(m3)
p1 / p2 / p3
The last line, p1 / p2 / p3
, tells R to stack them vertically. If you want to stack them horizontally, use p1 + p2 + p3
. If you're being feisty, you can also try (p1 + p2)/p3
to stack the first two horizontally and the last one beneath it.
