1

我正在尝试使用scatter3D()R 中的函数制作如下图:

散点图 3D 图

到目前为止一切顺利,但我正在努力将轴上的刻度标签Variant从 1, 2, 3 更改为A, B, C。有什么方法可以实现吗?

要创建上面的图:

library(plot3D)
n = 20 # number of datapoints
y = rep(c(1,2,3), each = n) # for plotting each line
x = rep(seq(-2, 2, length.out = n),3)
z = pnorm(x)

lapply(1:3, function(index){
  add = TRUE
  if(index == 1)
    add = FALSE
  scatter3D(x = x[y == index], 
            z = z[y == index], 
            y = y[y == index], 
            type = "l", 
            phi = 20,  
            theta = -50,
            xlab = "RT1", 
            ylab = "Variant", 
            zlab = "Delta", 
            col = "red", 
            ticktype = "detailed", 
            add = add, 
            ylim = c(0,4), 
            xlim = c(-3, 3))
})
4

0 回答 0