[R] FW: Two-line title in R legend

David Winsemius dwinsemius at comcast.net
Mon Nov 12 15:51:54 CET 2012


On Nov 11, 2012, at 7:13 PM, Gabriel Toro wrote:

> Hi,
> 
> I am trying to use a legend title that is a bit too long for one line.  To try to break the title in two lines, I am using
> 
> legend (title="Top of Title\nbottom of title",  etc.  )
> 
> R prints the title as two lines, but the top line is outside the legend box.
> 
> How can I trick the R legend function to make the legend box taller so that it contains the top line?
> 

You should include an example with dummy data if you wnat tested solutions. You can try:

legend (title=atop("Top of Title","bottom of title"), ...  )

Plotmath expression are not allowed to have "\n" in them, as stated in the help page.

-- 
David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list