some packages have special plot objects, so when you do plot(object)
it produces one or several plots for this object.
An example is
data("cars")
m <- lm(dist~speed, data=cars)
plot(m)
which produces several plots to this linear model.
How can I get the code to these plots so I can manually reproduce them?
In this case ?plot.lm
has some more information, but that is not always the case.
To make it more clear, in this example the first plot is a residuals vs. fitted values plot, which I could get by plot(m$fitted.values, m$residuals)
. I found this by analysing str(m)
. In most cases this is not that obvious what the plot of an object does.