How to change bar width and axis breaks in a 3D plot made with rgl package
0
0
Entering edit mode
7.5 years ago
IOM • 0

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

rgl axis width 3D • 3.1k views
ADD COMMENT
0
Entering edit mode

Similar answers are available from Stack Overflow, for example: http://stackoverflow.com/questions/10811669/r-rgl-distance-between-axis-ticks-and-tick-labels

Might be worth searching there, as well.

ADD REPLY
0
Entering edit mode

Thanks Alex, I had not seen it. Chers

ADD REPLY

Login before adding your answer.

Traffic: 2736 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6