以下代码使用 lattice 的线框功能绘制了 3 个彩色平面。但是,我无法理解为什么通过设置颜色组不会改变图例。我尝试手动完成,但最终只更改了文本颜色。顺便问一下,有谁也知道如何使表面透明 70%?
library(lattice)
library(akima)
SurfaceData <- data.frame(
x=rep(seq(0,100,length.out=10),each=10,times=3),
y=rep(rep(seq(0,100,length.out=10),times=10),times=3),
z=c(rep(25,100),seq(30,70,length.out=100),seq(95,75,length.out=100)),
type=factor(rep(c("A","B","C"),each=100))
)
wireframe(z~x*y,data=SurfaceData,group=type,
col.groups=c("red","green","blue"),
scales = list(arrows=FALSE, col="black",font=10),
xlab = list("Variable X",rot=30),
ylab = list("Variable Y",rot=-30),
zlab = list("Variable Z",rot=90),
zlim = c(0,100),
#auto.key=TRUE,
auto.key=list(text=c("A","B","C"),col=c("red","green","blue"),lines=TRUE),
par.settings = list(axis.line = list(col = "transparent")),
)
结果:
谢谢!