问题
The mgcv
package in R lets you estimate smooth regressions on multiple variables. Here is an example:
library(mgcv)
set.seed(2) ## simulate some data...
dat = gamSim(1,n=400,dist="normal",scale=2)
mod = gam(y~te(x0, x1),data=dat)
par(mfrow = c(2,1))
plot(mod)
plot(mod, xlim = c(0, 0.5))
When I run this, the two plots look exactly the same. Why doesn't xlim = c(0, 0.5)
restrict the range of the horizontal axis? How can I achieve this?
Update on my session info:
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mgcv_1.7-22
loaded via a namespace (and not attached):
[1] grid_3.0.1 lattice_0.20-15 Matrix_1.0-12 nlme_3.1-109 tools_3.0.1
来源:https://stackoverflow.com/questions/25268430/xlim-not-working-in-plot-gam-in-mgcv