Skip to content
Prev 366332 / 398502 Next

\n and italic() in legend()

Hi,
Thanks a lot to Duncan Mackay for the trick using atop() [but the 
legends are centered and not left aligned] and also for the suggestion 
of William Michels to use simply ",". However this last solution 
prevents to use several legends.

Here is a solution to allow both return within a legend and several legends:
plot(1, 1)
v1 <- c(expression(italic("p")*"-value"), expression("based on 
"*italic("t")*"-test"))
v2 <- c(expression(italic("w")*"-value for A"), expression("and B 
identical models"))
legend("topright", legend=c(v1, v2), lty=c(1, 0, 1, 0), y.intersp = 1, 
bty="n", col=c("black", "", "red", ""))

Thanks again

Marc


Le 29/12/2016 ? 10:54, Duncan Mackay a ?crit :