[R] little subplot in corner

Thomas Steiner finbref.2006 at gmail.com
Mon Mar 24 11:01:43 CET 2008


Henrique,

Although your solution is perfect, I had later a problem with setting
the background. Perhaps you know how to get this as well:

set.seed(24032008)
plot(rnorm(10),type="l",col="red")
grid()
front=c(0.5, .97, 0.5, .97)
par(fig=front, new=T)#, bg="skyblue" does not work
rec=c(par("usr")[1]+(par("usr")[2]-par("usr")[1])*front[1],
par("usr")[3]+(par("usr")[4]-par("usr")[3])*front[3],
par("usr")[1]+(par("usr")[2]-par("usr")[1])*front[3],
par("usr")[1]+(par("usr")[2]-par("usr")[1])*front[4])
#rect(rec[1],rec[2],rec[3],rec[4],col="yellow")
plot(rnorm(4),type="l",col="blue",xlab="",ylab="")

as you can see it would be good to be able to set the background of
the subfigure. as the par(bg=) does not work, I tried to plot a
rectangle. Just uncomment the send-last line and you will see that the
original plot disappears after some strange rectangle is drawn.

If you have any idea again, it would be evry much appreaciated to let me know.
Thomas

PS: to see my first attempts, look at
http://commons.wikimedia.org/wiki/Image:Eurusd-id.png



More information about the R-help mailing list