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

RJCallahan rjcal at u.washington.edu
Mon Mar 30 10:26:02 CEST 2009

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!


Richard Callahan
View this message in context: http://www.nabble.com/How-do-I-add-a-rug-to-a-3d-%27persp%27-plot--tp22778353p22778353.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list