[R] one question about title

David Brahm brahm at alum.mit.edu
Wed Sep 11 16:31:46 CEST 2002


Ken Lee <ken_lee at tynesys.com> asked (I'm paraphrasing) how to set cex.main
automatically so that his title will fit on the page.

Here's a solution that uses strwidth():

title.fit <- function(main, frac=.9, cex=par("cex.main"), ...) {
  while ((r <- strwidth(main, "f", cex)/frac) > 1.05) cex <- cex / r
  title(main, cex.main=cex, ...)
}
-- 
                              -- David Brahm (brahm at alum.mit.edu)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list