轴标签在 rgl 图中的位置

Position of axis label in rgl plot

我使用 rgl 包生成了曲面图。我想将 z 轴标签放置在我选择使用 axes3d 放置 z 轴边缘的位置。这是我的代码

alpha = 1.8
beta <- c(-1,1,0)
delta <- c(8,6,10)
gamma <- c(3,4,5)

m = 100
t = c(0:100)/m

d2 = delta[2]
d3 = delta[3]
g2 = gamma[2]
g3 = gamma[3]
b2 = beta[2]
b3 = beta[3]
z = (1-t)*d2 + t*d3
x = ((1-t)*g2)^alpha + (t*g3^alpha)
y = (((1-t)*g2)^alpha)*b2 + ((t*g3)^alpha)*b3
y = y/x
x = x^(1/alpha)

d1 = delta[1]
g1 = gamma[1]
b1 = beta[1]

xa = matrix(data = NA, nrow = m+1, ncol = m+1)
ya = matrix(data = NA, nrow = m+1, ncol = m+1)
za = matrix(data = NA, nrow = m+1, ncol = m+1)

for(i in 1:(m+1)){
  d2 = z[i]
  g2 = x[i]
  b2 = y[i]

  zz = (1-t)*d1 + t*d2
  xx = ((1-t)*g1)^alpha + (t*g2)^alpha
  yy = (((1-t)*g1)^alpha)*b1 + ((t*g2)^alpha)*b2
  yy = yy/xx
  xx = xx^(1/alpha)

  xa[i,] = xx
  ya[i,] = yy
  za[i,] = zz
}

persp3d(x = xa, y = ya, z = za, col = "red", 
        xlab = "", ylab = "", zlab = "", 
        main = "Skew-Stable Efficient Surface", axes = FALSE)
axes3d(edges = c("x--", "y--", "z-+"))
title3d(xlab = "Gamma", ylab = "Beta", zlab = "Delta")

这导致了以下情节。我想要 z 轴旁边的 z 轴标签 "Delta",就像其他两个轴的标签一样。如果我不必像解决方案中那样固定标签的位置,那就太好了 here

如果轴不在默认边上,使用mtext3d绘制。例如,

persp3d(x = xa, y = ya, z = za, col = "red", 
        xlab = "", ylab = "", zlab = "", 
        main = "Skew-Stable Efficient Surface", axes = FALSE)
axes3d(edges = c("x--", "y--", "z-+"))
title3d(xlab = "Gamma", ylab = "Beta")
mtext3d("Delta", "z-+", line = 2)

产生这个: