[R] Smoothing a persp graph
Guillaume Chapron
carnivorescience at gmail.com
Tue Jun 19 14:26:49 CEST 2012
Hi,
I'm unable to find a way to smooth data for a persp() graph.
Example, suppose that I have data x,y,z like this:
x <- 1:10
y <- 1:10
k <- 20
z <- outer(x, y, "*") + matrix( k*runif(100, -1, 1), 10, 10)
persp(x, y, z, theta = 35, phi = 25)
The graph is not very nice. Is there a way to smooth the z data so that at the end the graph would look more like something like that:
k <- 2
z <- outer(x, y, "*") + matrix( k*runif(100, -1, 1), 10, 10)
persp(x, y, z, theta = 35, phi = 25)
There seems to be many smoothing functions in R (e.g. loess) but I have not been able to find one for a 3D graph.
Thanks!
Guillaume
More information about the R-help
mailing list