Changing the tick labels with plot3D::scatter3D() in R

610 views Asked by At

I'm trying to make a plot like the following using the scatter3D() function in R:

scatter 3D plot

So far so good, but I'm struggling to change the tick labels on the axis Variant from 1, 2, 3 to A, B, C. Is there any way to implement this?

To create the plot above:

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))
})
0

There are 0 answers