Re: [R] persp plot

From: Ben Bolker <bolker_at_ufl.edu>
Date: Wed, 25 Jun 2008 14:05:31 +0000 (UTC)

Chad Junkermeier <junkermeier <at> byu.edu> writes:

>
> I have a set of data in the form
> x1, y1, z1
> x1, y2, z2
> ...
> x1, yN, zN
> x2, y1, z(N+1)
> x2, y2, z(N+2)
> ...
> x2, yN, z(2N)
> ...and so on...
> xM, yN, val(M*N)
>
> Do you have any suggestions?

  Not at all carefully tested, but:

## make up data
x = 1:50

y = 1:50
z = outer(x,y,function(x,y) sin(2*pi*(x/10))+cos(2*pi*(y/25))^2)
v = expand.grid(x,y)

dat = data.frame(x=v[,1],y=v[,2],z=c(z))

## data as they would be read from your original data file persp(x=unique(dat$x),y=unique(dat$y),dat$z)

  [in my example x changes more rapidly than y. You may need to play around with the identities of x and y]



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. Received on Wed 25 Jun 2008 - 14:09:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jun 2008 - 14:30:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive