Note that in the help(persp) you could read that "z: a MATRIX containing
the values to be plotted".
Hope this simple example can help you:

x1 <- 1:87
y1 <- 1:61
values <- volcano # which is a 87x61 matrix:
class(values)
persp(x1, y1, values)

If you would like to keep your data.frame setting, a possible function
would be plot.surface(fields).

Ciao,
Carlo Giovanni Camarda


===========================================
Camarda Carlo Giovanni
PhD-Student
Max Planck Institute for Demographic Research
Konrad-Zuse-Strasse 1
18057 Rostock, Germany
Tel:  +49 (0)381 2081 172
Fax: +49 (0)381 2081 472
camarda@demogr.mpg.de
===========================================

Date: Sat, 3 Jun 2006 11:54:55 +0200
From: Tor J?rund Sund <tjsund@suvitek.no>
Subject: [R] Help on plotting a 3 dimensional surface
To: <r-help@stat.math.ethz.ch>
Message-ID: <200606030954.k539suXq003608@mail47.fg.online.no>
Content-Type: text/plain

Hi

 

Im working on my master thesis, I need to get a plot currents
distributed
over a surface. 

I have the data listed in a dataframe with the x coordinates, y
coordinates
and the value.

Im using the persp function but I've not found out how to put the data
into
the z1 variable

 

es <-read.table("RDatalog_pass_dev_1_wafers_1_8V.txt",header=T,sep="\t")

x1 <- seq(0,40, length=40)

y1 <- x1

z1 <- ? (es[,5]is the column with the data, es[,3] is the x coocdinate,
and
es[,2] is the y coocrdinate]

persp(x1,y1,z1)

 

I will appreciate all help because this will be a nice thing to present
in
my report.

 

Tor J.




----------
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

