[R] Axes limits in rgl.surface.

Duncan Murdoch murdoch at stats.uwo.ca
Mon Dec 17 21:07:03 CET 2007


On 12/17/2007 2:29 PM, Todd Remund wrote:
> I have looked through the documentation and have not been able to find a way of using an xlim, ylim, or zlim type option on rgl.surface.  I know that persp3d has the option, but seems to only be able to expand the axes not reduce them.  Is there anyone who has an idea of how to do this?  Thank you for your time.

You'll need to do the trimming yourself.  There isn't currently any 
support for user-controlled clipping regions in rgl.

That is:  for the usual case where x and y are vectors, to limit x or y 
to a certain range, just take a subset of those values, and a subset of 
the rows or columns of z.  To limit the range of z, set out of range 
entries to NA.  It will probably look ugly because it will get a very 
ragged edge.

It appears that the NA handling for the case where x or y is a matrix 
leaves something to be desired.

Duncan Murdoch



More information about the R-help mailing list