I'm trying to figure out how I can arrange diagnostic plots differently using the plot() function. Here is my code:
mtcars_linear_model <- lm(mpg ~ wt, mtcars)
plot(mtcars_linear_model)
It will print these four plots in my console.
Is there a way to arrange them using ggarrange? I can't seem to print one of them at a time. I thought maybe I could call the index with the plot() function to get the plots one at a time but it doesn't work:
plot(mtcars_linear_model)[1]
I want to use each plot separately in ggarrange like this:
ggarrange(residuals_vs_fitted, normal_qq, scale_location, residuals_vs_leverage)
So that I could get one image with a 2x2 grid of these four diagnostic plots.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.