Question: How to change bar width and axis breaks in a 3D plot made with rgl package
0
gravatar for IOM
3.0 years ago by
IOM20
Birmingham
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

 

 

 

barplot width rgl 3d breaks • 554 views
ADD COMMENTlink modified 3.0 years ago by James W. MacDonald51k • written 3.0 years ago by IOM20
Answer: How to change bar width and axis breaks in a 3D plot made with rgl package
0
gravatar for James W. MacDonald
3.0 years ago by
United States
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).

ADD COMMENTlink written 3.0 years ago by James W. MacDonald51k

Thanks James, I did not think about that. Cheers

IOM

ADD REPLYlink written 3.0 years ago by IOM20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 335 users visited in the last hour