Hi
mkondrin wrote:
Hi!
Yes, it works (more or less), but the best is to use
grid.rect(width=2, height=2, gp=gpar(fill=ps.options()$bg.color))
grid.rect(width=unit(1,"npc")+unit(0.5,"inches"),...)
as postscript device leaves a 0.25-inch frame around the page.
BTW wouldn't you fix a bug with the determination of "strwidth" in the code like this:
l<-c("1","23","456","7890")
unit(1,"strwidth",l)
The last command calculates the width of the first element of l, which is not the thing one would like to have. The best would be the calculation of maximum length of vector's elements (a simple for-cycle in unit.c). It also solves the problems with
t<-grid.text(l,y=c(0.9,0.8,0.7,0.6))
unit(1,"grobwidth",t)
where the desired answer should be the length of the longest string in l (in R-2.0.1 this returns the length of the l[[0]] too).
I have fixed it in my R installation but the patch is obvious.
This is fixed (different) in R 2.1.0. If there are several strings, the width is taken from the bounding box of the strings. For example
grid.rect(width=grobWidth(grid.text(c("different", "bits of", "text", "with the longest", "not the first"), x=.5, y=1:5/6)))
Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html