To change colors of lines, you should replace auto.key
with key
and supply list of values for texts and lines.
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),
key=list(text=list(c("A","B","C"),col=c("red","green","blue")),
lines=list(lty=c(1,1,1),col=c("red","green","blue"))),
par.settings = list(axis.line = list(col = "transparent")),
)
To make colors transparent you can use function rgb()
. Here I define new variable mycolors.trans
that contain transparent colors and mycolors
with the same colors but not transparent for legend entries.
mycolors.trans = rgb(c(255,0,0),
c(0,255,0),
c(0,0,255),alpha = 70,maxColorValue = 255)
mycolors = rgb(c(255,0,0),
c(0,255,0),
c(0,0,255),maxColorValue = 255)
wireframe(z~x*y,data=SurfaceData,group=type,
col.groups=mycolors.trans,
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,
key=list(text=list(c("A","B","C"),col=mycolors),
lines=list(lty=c(1,1,1),col=mycolors)),
par.settings = list(axis.line = list(col = "transparent")),
)