How to change bar width and axis breaks in a 3D plot made with rgl package
1
0
Entering edit mode
IOM ▴ 20
@iom-7548
Last seen 7.8 years ago
Birmingham

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

 

 

 

3D rgl breaks barplot width • 1.6k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

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

ADD COMMENT
0
Entering edit mode

Thanks James, I did not think about that. Cheers

IOM

ADD REPLY

Login before adding your answer.

Traffic: 762 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