On Aug 20, 2013, at 2:28 PM, Nixon, John wrote: > A minimal R source code file producing this is: > > data=c(1,2) > pdf(file="error.pdf") > barplot(data) > legend(1.5,c(expression(italic("C.sativa"),italic("B.rapa"))),horiz=TRUE) > dev.off() > > The problem is that the two italicised strings are not aligned in the pdf > output, with the string on the left being lower than the string on the right > by size of about two dots. Removing the calls to expression and italic > produces correct alignment, but italic is required in the final figure. >
It's being caused by the descender of the letter "p". There are no letters with descenders in the first expression. `phantom` lets you add space and apparently does so both horizonatly which I how I've used it before and vertically as this demonstrates. Do this: data=c(1,2) pdf(file="error.pdf") barplot(data) legend(1.5,c(expression( phantom("p")*italic("C.sativa"), italic("B.rapa"))),horiz=TRUE) dev.off() -- David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list 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.