[R] Plotting individual points on a surface plot
Guadalupe García Rubio
guadalupegarciarubio at gmail.com
Mon Mar 29 17:39:53 CEST 2010
Hi all,
I'm trying to plot individual points on a surface plot. I want the
points to be hidden by the surface if they are below it.
AFAIK points() doesn't fulfill this requirement, so on the following
plot the point (50,50,0) is visible and it shouldn't:
x <- 1:100
y <- 1:100
pn <- persp(x, y, outer(x,y, function(x,y) x^2 + y^2), col='blue', border=NA)
points(trans3d(50, 50, 0, pn), col='red')
Using rgl & points3d the previous situation is fixed, but now points
very close to the surface are visible from both sides (maybe reducing
the size of the point would work?):
library(rgl)
pn <- persp3d(x, y, outer(x,y, function(x,y) x^2 + y^2), col='blue', border=NA)
points3d(50, 50, 0, col='red')
points3d(50, 50, 4950, col='red', pch = 1)
Does anybody know a solution to the above using any package?
Thanks in advance.
G.G.
More information about the R-help
mailing list