Hi,
Interesting idea, I'd be keen to hear about an R package to draw
chemical structures.
One possible hack is to use the tikzDevice package that lets you use
arbitrary LaTeX code in a plot, which is subsequently processed by
LaTeX (similar to psfrag in this regard). I found a small LaTeX
package with chemical macros, and with a little tweaking of the
margins you can get a decent result,
options(tikzLatexPackages =
c(getOption('tikzLatexPackages'),"\\usepackage{acide-amine}\n"))
d = data.frame(x=1:10, y=1:10, f=factor(sample(letters[1:2], 10, repl=TRUE)))
p <- qplot(x,y,data=d) + theme_bw() +
opts(plot.margin = unit(c(1, 1, 5, 1), "lines"),
axis.text.x = theme_text(size = 12 *
0.8, lineheight = 0.9, vjust = 10)) +
scale_x_continuous(breaks = c(2, 8), labels=c("\\phe{15}", "\\leu{15}"))
tikz("annotation.tex",standAlone=T,width=4,height=4)
print(p)
dev.off()
(output attached)
HTH,
baptiste