strwidth

Torsten Hothorn Torsten.Hothorn@rzmail.uni-erlangen.de
Wed, 14 Aug 2002 18:53:54 +0200 (MEST)


Dear plotting experts, 

I need to determine the width of a string before plotting it to the
current device because I want to adjust `mai' to have
the necessary space available. It seems to me that this is an "hen and
egg" problem: 

R> a <- "test"
R> strwidth(a)  
Error in strwidth(a) : plot.new has not been called yet

# ok, I need an open device

R> plot(1:2, type="n")
R> strwidth(a)
[1] 0.04760034

fine. But I can't continue to plot to the current device because I need to
reset `mai', so I need a second one ...

This is not really a problem if plotting to the screen but plotting to a
file leads to at least one page of non sense. Or am I just disoriented?

Torsten

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._