Skip to content

Instantly share code, notes, and snippets.

@baptiste
Created October 12, 2018 01:07
Show Gist options
  • Save baptiste/9505ff4f54b31d1d7149e435faf295f9 to your computer and use it in GitHub Desktop.
Save baptiste/9505ff4f54b31d1d7149e435faf295f9 to your computer and use it in GitHub Desktop.
library(tikzDevice)
library(ggplot2)
options(tikzLatexPackages =
c(getOption('tikzLatexPackages'),"\\usepackage{graphics}\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() +
theme(plot.margin = unit(c(1, 1, 5, 1), "lines"),
axis.text.x = element_text(size = 12 *
0.8, lineheight = 0.9, vjust = 10)) +
scale_x_continuous(breaks = c(2, 8), labels=c("\\includegraphics{a.png}", "\\includegraphics{b.png}"))
tikz("annotation.tex",standAlone=T,width=4,height=4)
print(p)
dev.off()
system('pdflatex annotation.tex && open annotation.pdf')
@baptiste
Copy link
Author

screen shot 2018-10-12 at 2 07 33 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment