[R] contour plots

Don MacQueen macq at llnl.gov
Mon Aug 25 18:26:52 CEST 2008

I think maybe you have to show your data a little better, and exactly 
how you are using contour. The posting guidelines request a small 
reproducible example; without that good help is difficult.

In the meantime, here is an example that works.

     x <- 1:4
     y <- 1:58
     z <- outer(x,y) * runif(4*58)

or perhaps
     contour( y, x, t(z) ) to exchange the axes

>  dim(z)
[1]  4 58

if you structure your data to be like my example, it should work.

You mention you have two lists. But note that there are no lists used 
in my example. To use lists, here is an example:

   tmp <- list(x=x, y=y, z=z)


At 4:17 PM +0200 8/25/08, Sybille Wendel wrote:
>I want to make a contour plot.
>I have a matrix (nrow=4,ncol=58) .
>and two lists, one with 4 values (the depths) and one with 58 values 
>(time in days)( Depth (should be                 later on the 
>y-axis),and Time(should be later on the x-axis))
>In the matrix there is the temperature for a specified depth and 
>time. there are missing values (NAs).
>I also put ranges for x-,y-,zlim.
>I tried this:
>But R always tells me the error, that there are not enough x or y 
>values. How can I solve the problem?
>I also looked in the mailing list, but I didn't find some similar problems.
>Thanks a lot for your help!
>best wishes, Sybille
>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.

Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

More information about the R-help mailing list