[R] textplot() in gplots causes problems (0x9)
Jonas Malmros
jonas.malmros at gmail.com
Thu Nov 1 19:36:09 CET 2007
Dear Gregory and members of R-Help
I found what was causing the problem, it was the fact that my R
Console window is minimized by me horizontally, and therefore summary
output does not fit and gets split, and function capture.output()
copies that into PDF!
I maximized R Console window so that summary(model) output fits on the
screen, and though I still get ërrors
2: In FUN(c("C", "a", "l", "l", ":", "l", "m", "(", "f", "o", "r", :
font width unknown for character 0x9
3: In strwidth(object, cex = cex) : font width unknown for character 0x9
4: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, :
font width unknown for character 0x9
5: In text.default(x = xpos, y = ypos, labels = object, adj = c(0, :
font width unknown for character 0x9
in PDF everything looks fine!
Thank you for your time!
Jonas.
On 11/1/07, Jonas Malmros <jonas.malmros at gmail.com> wrote:
> Dear Gregory,
>
> How can I avoid using tab character when all I want to do is to print
> a model summary on my pdf device using textplot()?
> How do I set the font size? If you mean using cex inside textplot,
> then it does not work. Whether cex is 1 or 0.2 I get the same result,
> exemplified here:
>
> Call:
> lm(formula =...)
> Resuduals:
> ...
>
> Coefficients Estimate
> (intercept) 1.32
> ... ...
> ... ...
>
> Std.Error t-value
> (Intercept) 0.2 0.1
> ... ... ...
> ... ... ...
>
> Pr(>|t|)
> (intercept) 0.01
> ... ...
> ... ...
>
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> Residual standard error: 1.748...
>
>
> Is there no solution to this problem?
> I am using Vista, R2.6.0 patched, RWinEdt.
>
> textplot(capture.output(summary(.model)), valign="top", halign="left", cex=0.5)
>
> Thanks in advance,
> Jonas
>
> On 11/1/07, Gregory Warnes <gregory.warnes at mac.com> wrote:
> > 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.
> >
> >
>
>
> --
> Jonas Malmros
> Stockholm University
> Stockholm, Sweden
>
--
Jonas Malmros
Stockholm University
Stockholm, Sweden
More information about the R-help
mailing list