Reputation: 792
I want to put multiple Time series plots on the same plot in R. I know we can usually do something like ts.plot(model1, model2, model3, col = 1:3)
. However, I now have 54 models. Is there an elegant way to this or i just plot them manually?
I think it will be something like:
for (i in 1:54){
ts.plot(model[i], model[i+1])
}
Upvotes: 0
Views: 155
Reputation: 388797
Use do.call
after getting all the plots in a list with mget
.
do.call(ts.plot, mget(paste0("model", 1:54)))
Upvotes: 1