raj rajaratnam
raj rajaratnam

Reputation: 331

How to get only certain plots when plot() returns multiple plots

When I use plot() with a linear model, I get 4 plots, A normal QQ plot, residuals vs fitted, etc.

How do I get it so I only get the normal QQ plot, or only residual plot. I did it before, I think there is an argument like number= n or something. I need to know so I can save images for all the plots.

Upvotes: 14

Views: 12653

Answers (1)

droopy
droopy

Reputation: 2818

you should read the documentation of the function plot.lm which is the plot function dedicated to lm. You can select the graphs that you want to display with argument "which". There is 6 graphs that you can choose:

# for the qqplot & residual plot
plot(lm1, which=c(2,1))

hth

Upvotes: 19

Related Questions