[R] Smoothing a persp graph

David L Carlson dcarlson at tamu.edu
Tue Jun 19 16:02:49 CEST 2012


kde2d is for two dimensional data. The persp graph is 3d.
 
Look at the StatDA package, particularly the Vignette for that package,
"Tutorial to the package StatDA" which discusses smoothing techniques
and kriging:

http://cran.r-project.org/web/packages/StatDA/vignettes/StatDA.pdf

For more options look at the Spatial Task View:

http://cran.r-project.org/web/views/Spatial.html

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Kehl Dániel
> Sent: Tuesday, June 19, 2012 8:42 AM
> To: r-help at r-project.org
> Subject: Re: [R] Smoothing a persp graph
> 
> Take a look at the
> 
> kde2d
> function in the MASS package, maybe it helps.
> 
> Best
> kd
> 
> 
> 
> 2012.06.19. 14:26 keltezissel, Guillaume Chapron mrta:
> > 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
> >
> > ______________________________________________
> > R-help at 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.
> >
> >
> >
> 
> 
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list