[Rd] grid stringHeight

From: baptiste auguie <baptiste.auguie_at_googlemail.com>
Date: Wed, 27 Apr 2011 11:06:44 +1200

Dear all,

I'm puzzled by the behavior of stringHeight in the grid package. Consider the following test,


test <- function(lab="dog", ...){
  g1 <- textGrob(lab)
  g2 <- rectGrob(height=grobHeight(g1), width=grobWidth(g1))
  gg <- gTree(children=gList(g1,g2), ...)

  print(c("height:", convertUnit(stringHeight(lab), "mm", "y")))   grid.draw(gg)

test(expression(dog), vp=viewport(x=0.6)) ## notice how the dog's tail is being cut off, where ## expression yields a snug cage

test(expression(aoc), vp=viewport(x=0.6))

It appears that stringHeight correctly calculates the height for an expression, but not for a basic string. I think it used to produce the same output for both.

Best regards,


R version 2.13.0 alpha (2011-03-27 r55076) Platform: i386-apple-darwin9.8.0 (32-bit)

[1] C

attached base packages:
[1] stats graphics grDevices utils datasets grid methods
[8] base

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 26 Apr 2011 - 23:09:01 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 Sat 30 Apr 2011 - 04:10:55 GMT.

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

list of date sections of archive