[R] graphics ignore tabs in text
Paul Murrell
p.murrell at auckland.ac.nz
Tue Oct 31 20:46:19 CET 2006
Hi
Marc Schwartz wrote:
> On Tue, 2006-10-31 at 09:13 -0500, Liaw, Andy wrote:
>> Dear R-help,
>>
>> I seem to recall that I can use "\t" to get tab in a string on a
>> graphics device, but it doesn't seem to work. Try:
>>
>> lab <- "a\tb\tc"
>> cat(lab, "\n") # works in the console output
>> plot(1:5, main=lab) # no tabs in the title
>> text(3, 3, lab) # no tabs in the text
>>
>> I get the same result both in the windows() and pdf() devices. Any
>> ideas?
>>
>> This is R-patched Windows binary just downloaded from CRAN.
>> R version 2.4.0 Patched (2006-10-29 r39744)
>>
>> Best,
>> Andy
>
> Andy,
>
> I don't believe that tab expansion works in plots, though I will stand
> to be corrected on that.
I'm surprised that this has never come up before, but I know of no
special handling of tabs in the graphics code. I suspect if we wanted
to do something we would have to add code to detect '\t' and replace it
with a number of spaces (maybe based on a user-settable option).
Paul
> Using the X11() device on FC5 (which I recreated using png() and
> attached here), you can clearly see the dashed boxes where the tab
> character (non-printable 0x9) is being drawn. However, it is one
> character, not expanded as is the case in a textual console/GUI.
>
> What are you trying to accomplish?
>
> Perhaps there is a better way (ie. to do column alignments, etc.) such
> as textplot() in the gplots package.
>
> HTH,
>
> Marc Schwartz
>
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list