[R] Re : how to plot select points in preexisting persp plot

Duncan Murdoch murdoch at stats.uwo.ca
Tue Feb 23 19:15:24 CET 2010


On 23/02/2010 6:01 AM, Preeti Iyer wrote:
> Hello,
> I have a set of points (x and y coordinates) generated by 
> multidimensional scaling function (isoMDS) . The z-axis coordinates 
> consists of a set of values for each of these x and y coordinates. I use 
> persp function to give a surface. What I would like to know is, how I 
> can use the z-coordinates to plot a text label for select points on this 
> surface?


See ?trans3d and ?persp.  Basically, do something like this:

pmat <- persp( .... )
text(trans3d( x, y, z, pmat), text=...)

This won't handle hiding text that falls behind things, but it should 
work in simple cases.   Another option is to use persp3d and text3d from 
the rgl package.

Duncan Murdoch



More information about the R-help mailing list