[R] Adding points to wireframe

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon Nov 21 21:28:59 CET 2005


On 11/21/05, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:
> On 11/18/05, Pierre-Luc Brunelle <pierre-luc.brunelle at polymtl.ca> wrote:
> > Hi,
> >
> > I am using function wireframe from package lattice to draw a 3D surface.
> > I would like to add a few points on the surface. I read in a post from
> > Deepayan Sarkar that "To do this in a wireframe plot you would probably
> > use the panel function panel.3dscatter". Does someone have an example?
>
> Here goes. Let's say the surface you want is:
>
> surf <-
>     expand.grid(x = seq(-pi, pi, length = 50),
>                 y = seq(-pi, pi, length = 50))
>
> surf$z <-
>     with(surf, {
>         d <- 3 * sqrt(x^2 + y^2)
>         exp(-0.02 * d^2) * sin(d)
>     })

Add

g <- surf

here if you want the rest to work. Sorry about that.
-Deepayan




More information about the R-help mailing list