[R] Gridbase basic question
Sean Davis
sdavis2 at mail.nih.gov
Thu Sep 23 17:04:44 CEST 2004
All,
I have a simple plot(x,y) and I would like to then insert rectangles of
some length (in native coordinates) and height fixed to 0.5 in native
coordinates. I can't quite get the code right to do this. Can anyone
give me a quick example of how to do this? I looked the gridBase index
and the tutorial (from R-news?) but just haven't gotten it down yet.
> plot(1:10,1:10)
> par(new=T);vps <- baseViewports()
> pushViewport(vps$inner,vps$figure,vps$plot)
viewport[GRID.VP.28]
> pushViewport(viewport(x=unit(1,"native"),y=unit(2,"native")))
viewport[GRID.VP.29]
>
grid.rect(height=unit(0.5,"native"),width=unit(1.5,"native"),just='botto
m')
This draws a very large rectangle going from 2 to 7 (y) and to 8 (x).
Thanks,
Sean
More information about the R-help
mailing list