Question: How to change bar width and axis breaks in a 3D plot made with rgl package
0
IOM20 wrote:

Hi,

Thanks for reading. I have made a 3D plot with rgl, and I am unable to change the width of the bars, the number of breaks of an axis and how to suppress the numbering of an axis. Anyone has any idea? Please find the code attached.

library(rgl)
# create some data
X=c(10,8,9,7,6,5,4,3,2,1) # Patient ID
Y=c(115,60,100,72,100,96,95,65,62,32) # Days
Z=c(-100,-60,-60,-30,-15,-10,15,35,40,50) # % RECIST

# create an empty plot with the good dimensions
plot3d(1,1,1, type='n', xlim=c(min(X),max(X)), ylim=c(min(Y),max(Y)), zlim=c(min(Z),max(Z)), xlab="", ylab="", zlab="", axe=F )

# draw Y bars
for(i in X){ segments3d(x = rep(X[i],2), y = c(0,Y[i]), z=0, lwd=6, col="gold")} # All time bars the same colour

# draw X bars

for(i in c(10,9,8,7)){segments3d(x = rep(X[i],2), y = 0, z=  c(0,Z[i]), lwd=6, col="red")}
for(i in c(6,5)){segments3d(x = rep(X[i],2), y = 0, z=  c(0,Z[i]), lwd=6, col="blue")}
for(i in c(4,3,2,1)){segments3d(x = rep(X[i],2), y = 0, z=  c(0,Z[i]), lwd=6, col="green")}
# draw axis
axes3d()
mtext3d(text = "Days", edge = "y+", line =3, col=1 )
mtext3d(text = "%RECIST", edge = "z++", line = 5, col=1 )

Thanks.

Regards

IOM

Answer: How to change bar width and axis breaks in a 3D plot made with rgl package
0
James W. MacDonald51k wrote:

rgl is a CRAN package, so you should ask your question at the R-help listserv (r-help@r-project.org).

Thanks James, I did not think about that. Cheers

IOM