[R] Again on overlaying plots (a plot region within a plot region)

Greg Snow Greg.Snow at imail.org
Wed Dec 2 19:47:11 CET 2009


Look at the subplot function in the TeachingDemos package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Ottorino-Luca Pantani
> Sent: Wednesday, December 02, 2009 1:15 AM
> To: ERRE
> Subject: [R] Again on overlaying plots (a plot region within a plot
> region)
> 
> Dear R-users,
> after seeking for help in R-search
> I did not find any hint on my particular problem.
> Countless help on "true" overlay, but nothing on this.
> 
> 
> Please consider the following:
> 
> par(mfrow = c(2, 1))
> T <- seq(0, 20, by = 0.01)
> ## PLOT 1
> plot(T,  30*exp(-0.65*T),
>      type = "l"
>      )
> points(T, 30*exp(-0.26 * T), type = "l", lty = "F8")
> points(T, 30*exp(-0.15 * T), type = "l", lty = "39")
> ## PLOT 2
> plot(T,  30*exp(-0.65*T),
>      type = "l",
>      log= "y"
>      )
> points(T, 30*exp(-0.26 * T), type = "l", lty = "F8")
> points(T, 30*exp(-0.15 * T), type = "l", lty = "39")
> 
> What I would like to do is to draw a square plot of PLOT 1 and
> then overlay the *entire* PLOT 2 on the upper right corner of PLOT 1,
> when there's a lot of empty space
> I have to do that because the publisher asked me not to waste
> much space with figures.
> 
> I studied for some time the Paul Murrell's excellent book "R Graphics",
> but I did not find what I'm looking for.
> 
> As far as I understand, layout() is intended to flexibly
> divide the plot region, not to subdivide the plot region
> nor the figure region.
> 
> One solution could be to export PLOT 1 , say as png,
> and then overlay on it PLOT 2 with pixmap() as in this example
> 
> http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-pixmap.R
> 
> but it seems to me a bit too much complicate
> 
> Thanks in advance for your time
> 
> 
> --
> Ottorino-Luca Pantani, Università di Firenze
> Dip. Scienza del Suolo e Nutrizione della Pianta
> P.zle Cascine 28 50144 Firenze Italia
> Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+
> Version 2.12.9)
> ESS version 5.5 -- R 2.10.0
> 
> ______________________________________________
> 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