[R] How do I add a rug to a 3d 'persp' plot?

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Apr 2 13:19:32 CEST 2009



RJCallahan wrote:
> Hi all,
> 
> I have a (hopefully quick) question. I've got a fascinating set of fitted
> surfaces in three dimensions corresponding to local linear multiple
> regressions. I'd like to add rugs to the X and Y axes (corresponding to my
> independent variables) in order to get a sense for how many data points I'm
> working with to graph various portions of the surfaces. The trouble is, I
> can't just plot the rugs with rug() because it's a 3-d plot. Similarly, I
> can't just pass rug() into trans3d() because trans3d() requires a set of
> three coordinates, right? And rug() internally calls on Axis(), which
> doesn't correspond to anything that references points.
> 
> I'm thinking I'll have to draw the rugs manually by figuring out what set of
> lines() commands would do the same thing to a plot as rug(), and then
> passing those lines() commands as parameters into trans3d() as per the
> example at the bottom of ?persp. I thought I'd ask, first, in case someone
> else has this problem: is there an easy way to add rugs to a 3-d plot
> generated using 'persp'? Thank you very much!


Simple answer: "No", AFAIK.

Uwe Ligges


> Sincerely, 
> 
> Richard Callahan




More information about the R-help mailing list