[R] limit to complex plots?
Paul Murrell
p.murrell at auckland.ac.nz
Sat Feb 28 22:15:23 CET 2004
Hi
You could do this sort of thing easily using viewports in the grid
package. And you can combine "base" plots with grid viewports using the
gridBase package. Take a look at Volume 3(2) of R News for some
examples and feel free to contact me directly if you have more
questions; I'm always interested to see examples of complex plots.
Paul
Suzanne E. Blatt wrote:
> Hello all.
>
> I am trying to create one figure, divided into 6 graphs/plots each with an inset sub-figure. I can use to layout command to generate one figure with one inset sub-figure, but cannot seem to do it for multiple figures on one page.
>
> I've tried a test with the following code:
>
> layout(matrix(c(1,2,3,4), nrow=2, byrow=TRUE))
> plot(rnorm(10), rnorm(10))
> plot(rnorm(10), rnorm(10))
> plot(rnorm(30), rnorm(30))
> plot(rnotm(40), rnorm(40))
> layout.show(4)
>
> #this works and gives me my one page with 4 figures on it
>
> layout(matrix(c(0,0,0,0,0,1,0,2,0,0,0,0,0,3,0,4), nrow=4, byrow=TRUE))
> par(new=TRUE)
> plot(rnorm(10), rnorm(10))
>
> par(new=TRUE)
> plot(rnorm(20), rnorm(20))
>
> par(new=TRUE)
> plot(rnorm(30), rnorm(30))
>
> par(new=TRUE)
> plot(rnorm(40), rnorm(40))
>
> # this is the part that doesn't. I've tried only one 'par(new=TRUE)' command before ALL the plot commands and as written above. The best I can get is 3 sub-figures #2,3 and 4, in positions 1,2 and 3.
>
> Has anyone figured this out?
>
> thanks,
> Suzanne Blatt
>
> __________________________________________________________________
> Introducing the New Netscape Internet Service.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list