[R] using "\t" in mtext

Marc Schwartz marc_schwartz at comcast.net
Fri Mar 23 18:52:26 CET 2007


On Fri, 2007-03-23 at 18:29 +0100, Thomas Kaliwe wrote:
> Hi,
>  
> Using tab spaces in mtext e.g.
>  
> > mtext("\t")
>  
> little squares are plotted. Is there a way to use "\t" without getting
> squares displayed?
>  
> Thanks
>  
> Thomas

See this post:

  http://tolstoy.newcastle.edu.au/R/e2/help/06/11/4211.html

You could set up a vector of spaces of the effective tab length that you
wish:

  TAB <- paste(rep(" ", 8), collapse = "")

but bear in mind that unless you are using a monospace font in the
graph, it won't work for text alignment.

If you need text alignment (ie. columns, etc.) consider using the
textplot() function in the gplots package, which I reference in the post
above.

Also reviewing this thread:

  http://tolstoy.newcastle.edu.au/R/help/02b/0346.html

and using:

  RSiteSearch("text alignment plot")

might bring up other posts with alternate approaches.

HTH,

Marc Schwartz



More information about the R-help mailing list