Re: [R] Axes limits in rgl.surface.

From: Duncan Murdoch <>
Date: Mon, 17 Dec 2007 15:07:03 -0500

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 17 Dec 2007 - 20:12:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Dec 2007 - 20:30:19 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.