A better response rating is good, but in a more complex scenario with linebreaks, this did not work for me, so instead I used unicode characters instead. For your example:
library(Unicode) italic_i <- u_char_inspect(u_char_from_name("MATHEMATICAL ITALIC SMALL I"))["Char"] label1 <- paste("P(", italic_i, ")=8", italic_i, sep="") label2 <- paste("A(", italic_i, ")=1+4", italic_i, "(", italic_i, "-1)", sep="") i <- 1:(8*365/7) d <- data.frame(i=i,p=p(i),a=sapply(i,a)) d <- melt(d, id.vars='i') p <- ggplot(d, aes(i, value, linetype=variable)) + geom_hline(yintercept=700^2) + geom_line() + scale_linetype_manual(values=c(2,1)) + #geom_point() + scale_x_continuous(breaks=(0:20)*365/7, labels=0:20) + #scale_y_continuous(breaks=c(0,700^2), labels=c(0,expression(L^2))) scale_y_sqrt() + #scale_y_log10() + annotate('text', 8*365/7, 1e3, label=label1, hjust=1, size=3) + annotate('text', 8*365/7, 2.5e5, label=label2, hjust=1, size=3) print(p + theme_classic())

Edit: I just noticed that saving a PDF file using pdf () doest does not display unicode correctly, but you can just use cairo_pdf (), which works just fine (see Unicode characters in ggplot2 PDF Output )
Johannes Titz
source share