# [R] contour plots

From: dbeest <detebeest_at_hotmail.com>
Date: Tue, 22 Jun 2010 06:29:35 -0700 (PDT)

I'm having difficulty making a contour plot a would like some help.

A standard contourplot can be made by having an x,y, and some matrix (shape x*y) with contents:

x = 1:10
y = 1:10
cont <- matrix(runif(100,min=1,max=2),nrow=10,ncol=10) filled.contour(x,y,cont)

Looks very nice.

Sometimes data comes in a different format however. Basically an x and an y, and a vector z with all realisations of some f(x,y). The only R way of making a contour plot out of this I can find is:

```x = runif(100,min=0,max=10)
y = runif(100,min=0,max=10)
z = runif(100,min=0,max=2)
```

contourplot(z ~ x * y, region = TRUE)

Increasing the number of points to see if that fits better:

```x = runif(1000,min=0,max=10)
y = runif(1000,min=0,max=10)
z = runif(1000,min=0,max=2)
```

contourplot(z ~ x * y, region = TRUE)

...hang on that doesn't plot anything: not my main question, but if anyone cares to explain why that is..

cheers,

Dennis

```--
View this message in context: http://r.789695.n4.nabble.com/contour-plots-tp2264113p2264113.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help