我正在做人 - 环境拟合研究,并希望在莱迪思线框绘制的响应面的xy平面上添加P = E和P = -E线。目前,我的代码如下:
PersonIV <- seq(-3, 3, length = 30)
EnvironmentIV <- seq(-3, 3, length = 30)
g.test.data <- expand.grid(PersonIV = PersonIV, EnvironmentIV = EnvironmentIV)
g.test.data$DV <- .5 + .4 * PersonIV + .6 * EnvironmentIV + .9 * PersonIV^2 + .7 * PersonIV * EnvironmentIV - .3 * EnvironmentIV^2
library(lattice)
trellis.par.set("axis.line", list(col = NA))
wireframe(DV ~ PersonIV * EnvironmentIV, g.test.data,
drape = T, screen = list(z = 30, x = -75),
main = "Person - Environment Fit Response Surface",
xlab = list(xlim = c(-3:3), label = "Personal IV", col = "black", font = 1, cex = 1, rot = 15),
ylab = list(label = "Environment IV", ylim = c(-3: 3), font = 1, cex = 1, rot = -42),
zlab = list(label = "DV", zlim = c(0:5), font = 1, cex = 1, rot = 90, lines = T),
scale = list(arrows = F, cex = 1, col = "black", tck = 1),
par.settings = list(box.3d = list(col=c(1,1,NA,NA,1,NA,1,1,1))),
)
非常感谢!
答案 0 :(得分:0)
制作自定义面板功能并将其传递给具有wireframe
参数的网格绘图功能(此处为panel
)是执行此操作的常用方法。要重新创建现有的绘图,通常使用panel.xyplot
,并且为了添加行,通常使用panel.abline
。也许是这样的。
panel=function(...) {panel.xyplot(...); panel.abline(0,1); panel.abline(0,-1)}