[R] axes3d/bbox3d - axis values not fixed

Duncan Murdoch murdoch.duncan at gmail.com
Sat Oct 8 13:09:27 CEST 2011


On 11-10-07 2:32 PM, Ben qant wrote:
 > Hello,
 >
 > I'm using the rgl package and plotting a plot with it. I'd like to 
have all
 > the axes values auto-hide, but I want to plot a series of characters 
instead
 > of the values of the measurement for 2 of the axes. So in the end I will
 > have one axis (z actually) behave per normal (auto-hide) and I'd like the
 > other two axes to be custom character vectors that auto-hide.

The axes in rgl are a little messy.  It's been on my todo list for a 
long time to fix them, but there are a lot of details to handle, and 
only so much time.

Essentially there are two separate systems for axes:  the "bbox3d" 
system, and the "axis3d" system.  The former is the ones that appear and 
disappear, the latter is really just lines and text added to the plot.

 >
 > Example:
 > x<- 1:10
 > y<- 1:10
 > z<- matrix(outer(x-5,y-5) + rnorm(100), 10, 10)
 > open3d()
 > persp3d(x, y, z, col="red", alpha=0.7,
 > aspect=c(1,1,0.5),xlab='',ylab='',zlab='', axes=F)
 >
 > For the above, axes=F for demonstration purposes only. Now when I call:
 > axes3d()
 > ...the axis values hide/behave the way I want, but I want my own 
characters
 > in there instead of the values that default.

You want to use the bbox3d() call.  For example,

bbox3d(xat=c(5, 10), xlab=c("V", "X"), yat=c(2,4,6), zunit=10)

for three different types of labels on the three axes.  It would be nice 
if axis3d had the same options as bbox3d, but so far it doesn't.

Duncan Murdoch

 >
 > Trying again:
 > open3d()
 > persp3d(x, y, z, col="red", alpha=0.7,
 > aspect=c(1,1,0.5),xlab='',ylab='',zlab='', axes=F)
 > axis3d('x',labels='test')
 > ...puts in a custom character label 'test', but I loose the 
behavior/hiding.
 >
 >
 > Also, then how do I get the values for the z axis to populate with the
 > default values and auto-hide with the other two custom string axes
 > auto-hiding?
 >
 > I'm pretty sure I need to use bbox3d(), but I'm not having any luck.
 >
 > I'm new'ish to R and very new to the rgl package. Hopefully that makes
 > sense.
 >
 > Thanks for your help!
 >
 > ben
 >
 > 	[[alternative HTML version deleted]]
 >
 > ______________________________________________
 > R-help at r-project.org mailing list
 > https://stat.ethz.ch/mailman/listinfo/r-help
 > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 > and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list