I have a stupid problem that is currently driving me crazy...
Let us suppose that I want to draw a big red square in the middle of my
current device (say X11)

I tried the following code :

pushViewport(viewport(xscale=c(0,1), yscale=c(0,1)), just=c("center", "center"))
vp1 <- viewport(x=unit(0.5, "native"), y=unit(0.5, "native"),
width=unit(0.4, "native"), height=unit(0.4, "native"),
just=c("center", "center"))
grid.rect(x=unit(0, "snpc"), y=unit(0, "snpc"), width=unit(1, "snpc"),
height=unit(1, "snpc"), gp=gpar(col=rgb(0.9, 0, 0), fill=rgb(0.9, 0,
0), just=c("center", "center")), vp=vp1)

(I know I could do this in a simpler way, but let's suppose I want to go
through the pushviewport / viewport def / grid.rect with vp argument
sequence)
I must be missing something obvious ! What am I doing wrong ?
Thanks by advance for your help.

Pierrick Bruneau
CRP Gabriel Lippmann

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to