Hi Jonas,
By default, textplot() attempts to automatically select a font size
that is 'just big enough, but not too big'. It does this by a binary-
search approach where it sets a font size, then asks R to compute the
actual width of the text to be displayed (without actually displaying
it), then increases or decreases the font size appropriately until it
finds the largest font that doesn't extend beyond the plot region
vertically or horizontally. It appears that on your system, R
doesn't know how wide a tab character is. This isn't particularly
surprising since tab characters vary in width depending on the context.
There are two simple solutions. First, avoid using characters R
can't figure out sizes for (i.e. tab), or manually specify the font
size so textplot() doesn't attempt to optimize it.
I personally choose the former, avoid tab characters, since the
appropriate font size varies greatly by device.
-Greg
On Oct 31, 2007, at 3:22PM , Jonas Malmros wrote:
> Hello,
>
> I am using textplot function in gplots package to put some model
> output inside a PDF file, but it does not seem to work properly with
> PDF.
>
> I am doing follwing:
> pdf(file="C:/...", paper="a4", width=8, height=12)
> .model <- lm(.model.formula, data=database)
> textplot(capture.output(summary(.model)), valign="top",
halign="left")
>
> I am getting these error messages:
>
> Warning messages:
> 1: In FUN(c("C", "a", "l", "l",
":", "l", "m", "(", "f",
"o", "r", :
> font width unknown for character 0x9
> 2: In strwidth(object, cex = cex) : font width unknown for
> character 0x9
> 3: In FUN(c("C", "a", "l", "l",
":", "l", "m", "(", "f",
"o", "r", :
> font width unknown for character 0x9
> 4: In strwidth(object, cex = cex) : font width unknown for
> character 0x9
> 5: In FUN(c("C", "a", "l", "l",
":", "l", "m", "(", "f",
"o", "r", :
> font width unknown for character 0x9
> 6: In strwidth(object, cex = cex) : font width unknown for
> character 0x9
> 7: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, :
> font width unknown for character 0x9
> 8: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, :
> font width unknown for character 0x9
>
> This is a tab character that causes problems, I guess. Is there any
> way to solve this?
>
> Thank you in advance
>
> --
> Jonas Malmros
> Stockholm University
> Stockholm, Sweden
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.