在格子线框图中删除面板轮廓/添加轴刻度和色标轮廓

remove panel outline / add axis ticks and colour scale outline in lattice wireframe plots

我有一系列线图,类似于下面的例子;

require(lattice)

# set up some data
theta <- seq(-3, 3, .4)
data <- expand.grid(theta, theta)
data$z <- dnorm(data[,1]) * dnorm(data[,2])
names(data) <- c('x','y','z')

# plot it
wireframe(z ~ x * y, data,
          scales = list( arrows = FALSE),
          aspect = c(1, .6),
          drape = TRUE)

给出了下面的情节。

我想删除面板轮廓。标准的解决方案是使用 par.settings = list(axis.line = list(col = 'transparent'));

# try to remove outline
wireframe(z ~ x * y, data,
          scales = list( arrows = FALSE),
          aspect = c(1, .6),
          drape = TRUE,
          par.settings = list(axis.line = list(col = 'transparent')))

确实删除了轮廓,但不止于此...

轴刻度线以及色标周围的轮廓也被删除。解决方案可用于 2d 图,例如 Controlling axis ticks and axis lines separately on R lattice xyplot ,但我一直无法为 3d/wireframe 图找到类似的解决方案。

我试过根据上述答案提供轴函数,但似乎该函数仅在 top/bottom/left/right 时被调用,这对于 3d 图不是很有用。

问题;

如何在设置 par.settings = list(axis.line = list(col = 'transparent')) 时阻止格子删除刻度线和刻度线?

否则,什么函数用于线框图上的刻度线,什么函数用于色标上的轮廓?

此代码将完成这项工作。

wireframe(z ~ x * y, data,
          scales = list( arrows = FALSE, col="black"), # col="black" is required 
          aspect = c(1, .6),
          drape = TRUE,
          par.settings = list(axis.line = list(col = 'transparent'))
)

改编自Seth W Bigelow's answer