[R] contour plots

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

Hi All,

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:

library(lattice)

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)

which is pretty ugly. And I don't think it needs to be. Does anyone know a way to make plots of the first type with data of the second type?

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
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 22 Jun 2010 - 16:01:10 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 22 Jun 2010 - 16:30:35 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