In plot.gam()note that plot()is called on x$smooth[[i]], which is an object of the class:
class(x$smooth[[i]])
[1] "tprs.smooth" "mgcv.smooth"
There is a method plot()for the class "mgcv.smooth", and this is what is used for the graph in the general case. ?plot.gammentions that this is the default method used for most smoothnesses, but there are specific methods for certain types of fins supported gam()(from the details section ?plot.gam:
For smooth terms ‘plot.gam’ actually calls plot method functions
depending on the class of the smooth. Currently random effect and
Markov random field smooths have special methods, the rest use the
defaults described below.
For some reason, methods()does not find these methods, but they exist:
> mgcv:::plot.mgcv.smooth
function (x, P = NULL, data = NULL, label = "", se1.mult = 1,
se2.mult = 2, partial.resids = FALSE, rug = TRUE, se = TRUE,
scale = -1, n = 100, n2 = 40, pers = FALSE, theta = 30, phi = 30,
jit = FALSE, xlab = NULL, ylab = NULL, main = NULL, ylim = NULL,
xlim = NULL, too.far = 0.1, shade = FALSE, shade.col = "gray80",
shift = 0, trans = I, by.resids = FALSE, scheme = NULL, ...)
{
....
methods(), , plot.function , R . , , ( ), methods() (, showMethods()), , .