Hi Marc, I can't seem to get "\n" to work, but simply using c() and "y.intersp = 1" looks fine:
> plot(1, 1) > v1 <- c(expression(italic("p")*"-value"), expression("based on > "*italic("t")*"-test")) > legend("topright", legend=v1, y.intersp = 1, bty="n") Hope this helps, Bill William Michels, Ph.D. On Thu, Dec 29, 2016 at 1:35 AM, Marc Girondot via R-help <r-help@r-project.org> wrote: > Hi everyone, > > Could someone help me to get both \n (return) and italic() in a legend. Here > is a little example showing what I would like (but without the italic) and > second what I get: > > plot(1, 1) > v1 <- "p-value\nbased on t-test" > legend("topright", legend=v1, y.intersp = 3, bty="n") > > plot(1, 1) > v1 <- expression(italic("p")*"-value\nbased on "*italic("t")*"-test") > legend("topright", legend=v1, y.intersp = 3, bty="n") > > The second one shows : > > -value > pbased on t-test > > rather than the expected: > > p-value > based on t-test > > Thanks a lot, > > Marc > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.