From: Ted Harding <Ted.Harding_at_manchester.ac.uk>

Date: Tue, 29 Jun 2010 10:36:22 +0100 (BST)

E-Mail: (Ted Harding) <Ted.Harding_at_manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861

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 Tue 29 Jun 2010 - 09:39:06 GMT

Date: Tue, 29 Jun 2010 10:36:22 +0100 (BST)

On 29-Jun-10 08:53:48, Kirkeby wrote:

> Hi again.

*>
**> I have made an example of my data:
**>
**> x<-c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4)
**> y<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
**> z <- c(12,23,23,42,12,1,1,32,5,45,65,76,32,21,23,43)
**> data <- unique(cbind(x,y,z))
**> contour(x,y,z, col="red", xlim=c(0,1), ylim=c(0,1), labcex=0.7,
**> cex="12")
**>
**> -which gives an error message.
**>
**> /CK
*

Have a close look at ?contour

x,y: locations of grid lines at which the values in 'z'

are measured. These must be in ascending order. z: a matrix containing the values to be plotted

('NA's are allowed).

Notice that 'contour' interprets the 'z' matrix as a table

of 'f(x[i], y[j])' values, so that the x axis corresponds to row number and the y axis to column number, with column 1 at the bottom, i.e. a 90 degree clockwise rotation of the conventional textual layout.

So your data above:

x<-c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4) y<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4) z <- c(12,23,23,42,12,1,1,32,5,45,65,76,32,21,23,43)

correspond to:

x <- c(1,2,3,4) ; y <- c(1,2,3,4)

(i.e. locations of grid *lines*, not points) with z being the matrix

12 12 5 32

23 1 45 21

23 1 65 23

42 32 76 43

i.e.

z <- matrix(c(12,23,23,42,12,1,1,32,5,45,65,76,32,21,23,43),ncol=4)

Then

contour(x,y,z)

should do the job!

Ted.

E-Mail: (Ted Harding) <Ted.Harding_at_manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861

Date: 29-Jun-10 Time: 10:36:20 ------------------------------ XFMail ------------------------------ ______________________________________________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 Tue 29 Jun 2010 - 09:39:06 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 Tue 29 Jun 2010 - 10:30:43 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.
*