[R] rgl: plane3d or abline() analog

Michael Friendly friendly at yorku.ca
Wed May 5 03:27:46 CEST 2010


Duncan Murdoch wrote:
> On 04/05/2010 4:19 PM, David Winsemius wrote:
>> On May 4, 2010, at 4:09 PM, Michael Friendly wrote:
>>
>>  
>>> For use with rgl, I'm looking for a function to draw a plane in an  
>>> rgl scene that would function
>>> sort of like abline(a, b) does in base graphics, where abline(0, 1)  
>>> draws a line of unit slope through
>>> the origin. Analogously, I'd like to have a plane3d function, so  
>>> that plane3d(0, 1, 1) draws a
>>> plane through the origin with unit slopes in x & y and plane3d(3, 
>>> 0,  0) draws a horizontal plane
>>> at z=3.
>>>
>>> I see that scatterplot3d in the scatterplot3d package returns a  
>>> plane3d() *function* for a given
>>> plot.  I could probably try to adapt this, but before I do, I 
>>> wonder  if something like this for
>>> rgl exists that I haven't found.
>>>     
>>
>> ?quads3d
>>
>>   
> It's harder than that, because a plane intersecting with the bounding 
> box of the data doesn't necessarily produce a quadrilateral:  some are 
> other polygons (e.g. an
> intersection near a corner can be a triangle).  Plus, you want to 
> still see a plane if you add new data and change the bounding box.  So 
> this is something that really needs to be done at the C++ level, and 
> though I've wanted one every now and then, I've never got around to 
> adding it.  Maybe soon.

If this makes it easier, what I was thinking of was a grid of lines 
parallel to the x & y axes which could be clipped
if necessary to the bounding box. 

-- 
Michael Friendly     Email: friendly at yorku.ca 
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list