[R] New line operator in mtext

Duncan Murdoch murdoch at stats.uwo.ca
Mon Jun 22 14:36:47 CEST 2009


On 6/22/2009 7:58 AM, Steve Murray wrote:
> Thanks for the response, however, whilst this eliminates the 'new line' character from appearing, it doesn't actually cause a new line to be printed! Instead, I have the last few characters of the first character string overlapping with the first few characters of the next.
> 
> How best should I change the code to execute a new line?

This works for me.

mtext(side=2, line=5.5, expression(paste("Monthly Summed Runoff 
(mm/month)\nand Summed Monthly Precipitation (mm x  ",10^2,"/month)")))

Note that the newline is embedded in the string that you want to split, 
it's not a separate element of the label.

Duncan Murdoch




More information about the R-help mailing list