Last active
September 18, 2018 09:39
-
-
Save baptiste/a514b9453059da40bdcdae7eb9889fa1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(gridExtra) | |
library(grid) | |
library(tikzDevice) | |
chem <- "\\setatomsep{1em}\\chemfig{*6(-=-=(-[:90]N-[:30](=[:90]O)-[:-30](=[:-90]O)-[:30]N-[:-30]-[:30]-[:-30]N-[:30](=[:90]O)-[:-30](=[:-90]O)-[:30]N-[:-30](-[:-90]-[:-30](-[:30])-[:-90])-[:30](=[:90]O)-[:-30]O-[:30])-*6(-(=O)-*6(-=-=-=)--(=O)-)=)}" | |
p <- ggplot() + xlab('some chemistry') + ylab("some value") + | |
theme(plot.background = element_rect(colour = 'black', fill=NA), | |
plot.tag = element_text(margin=margin(0,0,0,0)), | |
plot.tag.position = c(0,1)) | |
tikz(file = 'test.tex', standAlone = TRUE, width = 6, height=4, | |
engine = 'xetex', bareBones = FALSE, | |
packages = c("\\usepackage{chemfig}", | |
"\\usepackage{preview}", | |
"\\usepackage[default,osf]{sourcesanspro}")) | |
grid.arrange(grobTree(rectGrob(), | |
textGrob("\\textbf{a}", vjust=1,hjust=0,x=0,y=1, | |
gp=gpar(fontsize=14)), | |
textGrob(chem)), | |
p + labs(tag = "\\textbf{b}"), | |
p + labs(tag = "\\textbf{c}"), | |
layout_matrix = cbind(c(1,2),c(3,3)), | |
heights = c(2,5)) | |
dev.off() | |
Author
baptiste
commented
Sep 18, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment