[R] Text wrap

David Winsemius dwinsemius at comcast.net
Tue Aug 16 18:24:00 CEST 2011


On Aug 16, 2011, at 11:39 AM, Filoche wrote:

> Hi everyone.
>
> I have a long label that I would like to split. I found that I could  
> use
> "strwrap" for simple text. However, this is not working with this  
> label:
>
> plot(...., ylab = strwrap(str,20),...)
>
> I suspect this is because I'm using "expression" for form my label.
>
> I also tried with \n but this is not working either.

And the plotmath page warns you that it won't work

Have you looked at 'atop'?
Perhaps something like this ... after making an effort to interpret  
your incompletely describe goals:

plot(1,1, sub= expression(atop("< 20 µm phytoplankton  
","(cells·mL"^-1*")")))

You had two commas in that origial express and it wasn't at all clear  
why.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list