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.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to