Re: [R] little subplot in corner

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Mon, 24 Mar 2008 08:32:24 -0300

Perhaps:

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 set.seed(24032008)
x <- rnorm(4)
plot(x,type="l",col="blue",xlab="",ylab="", bg="yellow") rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="yellow") lines(x, col="blue")

On 24/03/2008, Thomas Steiner <finbref.2006_at_gmail.com> wrote:
> 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
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
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.
Received on Mon 24 Mar 2008 - 11:38:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 24 Mar 2008 - 22:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive