[R] problem plotting in a grid

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Jul 30 09:29:20 CEST 2012


Did you actually read the help file for filled.contour?

The image.plot call is being affected by the documented behavior of filled.contour.

ggplot might be worth investigating.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Jonathan <jonsleepy at gmail.com> wrote:

>Hi all,
>    I'm trying to generate a grid of four plots.  The first 2 appear
>just fine, but the final 2 will not appear in the grid, instead
>overwriting the first two.    Any ideas on how to get them all in the
>same window would be greatly appreciated.
>
>Cheers,
>Jonathan
>
>library(fields)
>
>par(mfrow=c(2,2)) #2x2 plot windows
>plot(c(2,4),c(2,2))  # works fine
>plot(c(2,4),c(2,2))  # works fine
>
>  x <- 1:4
>  y <- 5:10
>  z <- matrix(0,length(x),length(y))
>  z2 <- matrix(0,length(x),length(y))
>  for(i in 1:length(x))
>  {
>    for (j in 1:length(y))
>    {
>        z[i,j] <- sample(4:10,1)
>        z2[i,j] <- sample(4:10,1)
>    }
>  }
>
>  filled.contour(x,y,z,color.palette=topo.colors)  # doesn't work
>  image.plot(x,y,z2,add=TRUE)  # doesn't work
>
>______________________________________________
>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.



More information about the R-help mailing list