[R] Odp: Again on overlaying plots (a plot region within a plot region)
Petr PIKAL
petr.pikal at precheza.cz
Wed Dec 2 09:40:36 CET 2009
Hi
r-help-bounces at r-project.org napsal dne 02.12.2009 09:15:05:
> 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))
Do not use T as a name for object as it can be confused with logical T/F
par(fig=....) is what you want.
> 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
par(new=TRUE)
par(fig=c(.3,.95,.4,.95))
> 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")
Regards
Petr
>
> 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