0
votes

I have a plot

plot(wine$AGST ~ wine$Price, xlab="Price", ylab = "AGST", pch = 19)

and want to draw a regression line ie

abline(lm(Price ~ AGST, data=wine))

but facing error ie

abline(mod01) Warning messages: 1: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter 2: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter abline(lm(Price ~ AGST, data=wine)) Warning messages: 1: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter 2: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter abline(lm(Price ~ AGST, data=wine)) Warning messages: 1: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter 2: In doTryCatch(return(expr), name, parentenv, handler) : "lm" is not a graphical parameter

1
Your code should work: reproducible example plot(mtcars$mpg ~ mtcars$wt) ; abline(lm(mpg ~ wt, mtcars)) (note: I think your lm variables should be reversd lm(AGST ~ Price, data=wine)) - user20650

1 Answers

1
votes

Please provide reproducible example. Here is one example from mtcars data

Keep in mind that The plot (A ~ B) plots A as Y axis and B as X axis While plot(A , B) plots A as X axis and B as Y axis

Try following code with your data and let me know the result

plot(mtcars$mpg , mtcars$wt, xlab="mpg", ylab = "wt", pch = 19)
abline(lm(wt ~ mpg, mtcars))